JuliaTesting/TestReports.jl

Printing test report with failed chained test errors

mmiller-max opened this issue · 1 comments

Came across this nice one recently.

MWE:

using Test
using TestReports

ts = @testset ReportingTestSet "test" begin
    @test true && false
end

report(ts)

Results in this error:

ERROR: AssertionError: isempty(XML_GLOBAL_ERROR_STACK)
Stacktrace:
 [1] macro expansion at /Users/malmiller/.julia/packages/EzXML/BF7Lf/src/error.jl:49 [inlined]
 [2] ElementNode(::String) at /Users/malmiller/.julia/packages/EzXML/BF7Lf/src/node.jl:479
 [3] failure_xml(::String, ::String, ::String) at /Users/malmiller/repos/TestReports.jl/src/to_xml.jl:43
 [4] to_xml(::Test.Fail) at /Users/malmiller/repos/TestReports.jl/src/to_xml.jl:120
 [5] (::TestReports.var"#4#5")(::Test.Fail) at /Users/malmiller/repos/TestReports.jl/src/to_xml.jl:102
 [6] iterate at ./generator.jl:47 [inlined]
 [7] _collect(::Array{Test.Fail,1}, ::Base.Generator{Array{Test.Fail,1},TestReports.var"#4#5"}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at ./array.jl:699
 [8] collect_similar(::Array{Test.Fail,1}, ::Base.Generator{Array{Test.Fail,1},TestReports.var"#4#5"}) at ./array.jl:628
 [9] map(::Function, ::Array{Test.Fail,1}) at ./abstractarray.jl:2162
 [10] to_xml(::ReportingTestSet) at /Users/malmiller/repos/TestReports.jl/src/to_xml.jl:101
 [11] (::TestReports.var"#2#3")(::ReportingTestSet) at /Users/malmiller/repos/TestReports.jl/src/to_xml.jl:78
 [12] iterate at ./generator.jl:47 [inlined]
 [13] _collect(::Array{Test.AbstractTestSet,1}, ::Base.Generator{Array{Test.AbstractTestSet,1},TestReports.var"#2#3"}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at ./array.jl:699
 [14] collect_similar(::Array{Test.AbstractTestSet,1}, ::Base.Generator{Array{Test.AbstractTestSet,1},TestReports.var"#2#3"}) at ./array.jl:628
 [15] map(::Function, ::Array{Test.AbstractTestSet,1}) at ./abstractarray.jl:2162
 [16] report(::ReportingTestSet) at /Users/malmiller/repos/TestReports.jl/src/to_xml.jl:77
 [17] top-level scope at REPL[29]:1
 [18] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1088

Turns out this is occurs when an attribute value given to AttributeNode contains "&&".

JuliaIO/EzXML.jl#149

We can, however, use setindex! to set the attribute and this uses a different call to libxml2 and converts "&&" to "&&amp".