Skip to content

Commit

Permalink
booktest: add error checking for non-jlcon files also on master (osca…
Browse files Browse the repository at this point in the history
…r-system#4209)

* booktest: cleanup aux code

* booktest: add error-detection for non-jlcon files

* Add isequal methods for GAPGroup, BasicGAPGroupElem

---------

Co-authored-by: Max Horn <max@quendi.de>
  • Loading branch information
2 people authored and HechtiDerLachs committed Oct 30, 2024
1 parent 372cc88 commit 3e2e6c3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/Groups/GAPGroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,16 @@ end

Base.:*(x::GAPGroupElem, y::GAPGroupElem) = _prod(x, y)


isequal(x::GAPGroup, y::GAPGroup) = GapObj(x) == GapObj(y)

function ==(x::GAPGroup, y::GAPGroup)
_check_compatible(x, y)
return GapObj(x) == GapObj(y)
end

isequal(x::BasicGAPGroupElem, y::BasicGAPGroupElem) = GapObj(x) == GapObj(y)

# For two `BasicGAPGroupElem`s,
# we allow the question for equality if their parents fit together
# in the sense of `_check_compatible`,
Expand Down
2 changes: 0 additions & 2 deletions test/book/cornerstones/groups/auxiliary_code/main.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Pkg
Pkg.add(name="GenericCharacterTables", version="0.4"; io=devnull)
using GenericCharacterTables
# for nicer printing
using GenericCharacterTables: ParameterException
21 changes: 20 additions & 1 deletion test/book/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,18 @@ isdefined(Main, :FakeTerminals) || include(joinpath(pkgdir(REPL),"test","FakeTer
if jlcon_mode
input_string = "\e[200~$s\e[201~"
end
haderror = false
REPL.activate(mockrepl.mockdule)
# this allows us to detect errors in the middle of non-jlcon files
if !jlcon_mode
od = Base.active_repl.interface.modes[1].on_done
Base.active_repl.interface.modes[1].on_done = function (x...)
if Base.active_repl.waserror
haderror = true
end
od(x...)
end
end
result = redirect_stdout(mockrepl.out_stream) do
input_task = @async begin
write(mockrepl.stdin_write, input_string)
Expand All @@ -175,8 +186,16 @@ isdefined(Main, :FakeTerminals) || include(joinpath(pkgdir(REPL),"test","FakeTer
wait(input_task)
readuntil(mockrepl.output.out, "\nEND_BLOCK")
end
if !jlcon_mode
# restore on-done
Base.active_repl.interface.modes[1].on_done=od
end
REPL.activate(Main)
return sanitize_output(result)
output = sanitize_output(result)
if !jlcon_mode && haderror
error("ERROR in jl-mode:\n", output)
end
return output
end

function test_chapter(chapter::String="")
Expand Down

0 comments on commit 3e2e6c3

Please sign in to comment.