From 3e2e6c32918c4cb257a533dc6f7a4dfb8f7d51d4 Mon Sep 17 00:00:00 2001 From: Benjamin Lorenz Date: Fri, 18 Oct 2024 19:50:37 +0200 Subject: [PATCH] booktest: add error checking for non-jlcon files also on master (#4209) * booktest: cleanup aux code * booktest: add error-detection for non-jlcon files * Add isequal methods for GAPGroup, BasicGAPGroupElem --------- Co-authored-by: Max Horn --- src/Groups/GAPGroups.jl | 5 +++++ .../groups/auxiliary_code/main.jl | 2 -- test/book/test.jl | 21 ++++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/Groups/GAPGroups.jl b/src/Groups/GAPGroups.jl index 68152aa1ddf6..89321335532e 100644 --- a/src/Groups/GAPGroups.jl +++ b/src/Groups/GAPGroups.jl @@ -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`, diff --git a/test/book/cornerstones/groups/auxiliary_code/main.jl b/test/book/cornerstones/groups/auxiliary_code/main.jl index 7203d7aff1b1..4c15907921a1 100644 --- a/test/book/cornerstones/groups/auxiliary_code/main.jl +++ b/test/book/cornerstones/groups/auxiliary_code/main.jl @@ -1,5 +1,3 @@ import Pkg Pkg.add(name="GenericCharacterTables", version="0.4"; io=devnull) using GenericCharacterTables -# for nicer printing -using GenericCharacterTables: ParameterException diff --git a/test/book/test.jl b/test/book/test.jl index faf9a1cb3a8a..656d72b8b4d9 100644 --- a/test/book/test.jl +++ b/test/book/test.jl @@ -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) @@ -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="")