Skip to content

Make a failing @test_reference return a failed test instead of error() - #139

Open
MasonProtter wants to merge 1 commit into
masterfrom
mp/testfail
Open

MasonProtter wants to merge 1 commit into
masterfrom
mp/testfail

Conversation

@MasonProtter

Copy link
Copy Markdown
Member

The problem with it doing an error() is that this makes package testsuites always "fail fast" which is really annoying if you want to see the whole testsuite result.

Comment thread test/runtests.jl
Comment on lines +39 to +47
# A testset that collects results without propagating them to its parent, so we
# can check that `@test_reference` records a failure without failing our own suite.
struct CaptureTestSet <: Test.AbstractTestSet
description::String
results::Vector{Any}
end
CaptureTestSet(desc; kw...) = CaptureTestSet(desc, Any[])
Test.record(ts::CaptureTestSet, t) = (push!(ts.results, t); t)
Test.finish(ts::CaptureTestSet) = ts

@oxinabox oxinabox Nov 11, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if we should just go and fully use MetaTesting.jl ?

see #128

@oxinabox

Copy link
Copy Markdown
Member

Can we do this with
#81
instead?

@MasonProtter

Copy link
Copy Markdown
Member Author

Would you prefer to use MetaTesting, or the direction in #81?

I will say that if we do the #81 direction, I think it should have a different name than "test" if it just returns a bool, maybe matches_reference?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants