Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change @test ex broken=true to error if ex evaluates to non-boolean #47804

Merged
merged 4 commits into from
Dec 22, 2022
Merged
Changes from 1 commit
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
9 changes: 7 additions & 2 deletions stdlib/Test/src/Test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,13 @@ function do_broken_test(result::ExecutionResult, orig_expr)
# Assume the test is broken and only change if the result is true
if isa(result, Returned)
value = result.value
if isa(value, Bool) && value
testres = Error(:test_unbroken, orig_expr, value, nothing, result.source)
if isa(value, Bool)
if value
testres = Error(:test_unbroken, orig_expr, value, nothing, result.source)
end
else
# If the result is non-Boolean, this counts as an Error
testres = Error(:test_nonbool, orig_expr, value, nothing, result.source)
end
end
record(get_testset(), testres)
Expand Down