Add "invert_result" to test() option #14244
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is very similar to "should_fail", but does not change the test results to "Expected Fail" / "Unexpected Pass".
"Expected Fail" and "Unexpected Pass" are useful when they communicate to developers that additional work needs to be done, e.g. as part of Test Driven Development or to demonstrate problems with some edge cases that need to be addressed in the future.
In other cases, a non-zero status code is actually the whole test, e.g. a program under test that is expected to exit with a non-zero status code when given invalid arguments or a bad configuration file. This is the expected behavior and hence should be reported as "Pass", not "Expected Fail".
"invert_result" and "should_fail" can be combined to produce "Unexpected Pass" for non-zero status codes and "Expected Fail" for zero status codes.