-
-
Notifications
You must be signed in to change notification settings - Fork 40
Labels
enhancementNew feature or requestNew feature or request
Description
Sometimes for a test the "code under test" doesn't manage the exit code, but does manage a failure condition.
In that case, a bashunit test may want to assert that the exit code is non-zero without asserting a specific exit code.
As far as I can see, that is not currently possible with the build in assertions and it would be lovely if it would be possible.
Example of a test (for PHP_CodeSniffer) in which I would like to use this:
function test_phpcs_out_of_memory_error_handling() {
OUTPUT="$(bin/phpcs -d memory_limit=4M --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/)"
assert_unsuccessful_code
assert_contains "The PHP_CodeSniffer \"phpcs\" command ran out of memory." "$OUTPUT"
assert_contains "Either raise the \"memory_limit\" of PHP in the php.ini file or raise the memory limit at runtime" "$OUTPUT"
assert_contains "using \"phpcs -d memory_limit=512M\" (replace 512M with the desired memory limit)." "$OUTPUT"
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Done