Vendoring bats libraries.
Signed-off-by: Chad Metcalf <chad@docker.com>
This commit is contained in:
committed by
Chad Metcalf
parent
5185cedf4e
commit
6565a1f745
40
lib/bats-assert/test/assert_success.bats
Executable file
40
lib/bats-assert/test/assert_success.bats
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
@test "assert_success(): returns 0 if \`\$status' is 0" {
|
||||
run true
|
||||
run assert_success
|
||||
|
||||
assert_test_pass
|
||||
}
|
||||
|
||||
@test "assert_success(): returns 1 and displays details if \`\$status' is not 0" {
|
||||
run bash -c 'echo "a"
|
||||
exit 1'
|
||||
run assert_success
|
||||
|
||||
assert_test_fail <<'ERR_MSG'
|
||||
|
||||
-- command failed --
|
||||
status : 1
|
||||
output : a
|
||||
--
|
||||
ERR_MSG
|
||||
}
|
||||
|
||||
@test "assert_success(): displays \`\$output' in multi-line format if it is longer than one line" {
|
||||
run bash -c 'printf "a 0\na 1"
|
||||
exit 1'
|
||||
run assert_success
|
||||
|
||||
assert_test_fail <<'ERR_MSG'
|
||||
|
||||
-- command failed --
|
||||
status : 1
|
||||
output (2 lines):
|
||||
a 0
|
||||
a 1
|
||||
--
|
||||
ERR_MSG
|
||||
}
|
||||
Reference in New Issue
Block a user