Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/TestSetExtensions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ function ExtendedTestSet(desc; wrap=DefaultTestSet)
ExtendedTestSet{wrap}(desc)
end

function isVector(e)
if e.head === :vect
return true
end
#Float32 or Int32 arrays get here as Ref's to Vector

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is not quite true. The arrays get here with the same syntax as a Ref, but they're not actually a ref to a vector. Just a bit of a confusing overlap in the display of vectors and the syntax for Refs.

if e.head === :ref && isa(e.args, Vector)
return true
end
return false
Comment on lines +65 to +68

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since e::Expr, we have isa(e.args, Vector) to always be true. So the following suffice

Suggested change
if e.head === :ref && isa(e.args, Vector)
return true
end
return false
return e.head === :ref

end

function Test.record(ts::ExtendedTestSet{T}, res::Fail) where {T}
if Distributed.myid() == 1
println("\n=====================================================")
Expand All @@ -69,11 +80,10 @@ function Test.record(ts::ExtendedTestSet{T}, res::Fail) where {T}
elseif isa(res.data, String)
Meta.parse(res.data)
end

if test_expr.head === :call && test_expr.args[1] === Symbol("==")
dd = if isa(test_expr.args[2], String) && isa(test_expr.args[3], String)
deepdiff(test_expr.args[2], test_expr.args[3])
elseif test_expr.args[2].head === :vect && test_expr.args[3].head === :vect
elseif isVector(test_expr.args[2]) && isVector(test_expr.args[3])
deepdiff(test_expr.args[2].args, test_expr.args[3].args)
elseif test_expr.args[2].head === :call && test_expr.args[3].head === :call &&
test_expr.args[2].args[1].head === :curly && test_expr.args[3].args[1].head === :curly
Expand Down