Created
April 3, 2019 14:13
-
-
Save ChrisRackauckas/65af761f6637de0b27ab7c18116b1793 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro test_allowed_failure(ex, kws...) | |
test_expr!("@test_allowed_failure", ex, kws...) | |
orig_ex = Expr(:inert, ex) | |
result = Test.get_test_result(ex, __source__) | |
# code to call do_test with execution result and original expr | |
:(do_allowedfailure_test($result, $orig_ex)) | |
end | |
function do_allowedfailure_test(result::Test.ExecutionResult, orig_expr) | |
testres = Test.Broken(:test, orig_expr) | |
# Assume the test is broken and only change if the result is true | |
if isa(result, Test.Returned) | |
value = result.value | |
if isa(value, Bool) && value # if it is a pass, keep it | |
testres = result | |
end | |
end | |
Test.record(Test.get_testset(), testres) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment