mirror of
https://github.com/sstephenson/bats.git
synced 2024-12-26 14:39:46 +01:00
Add $lines array
This commit is contained in:
parent
4a71d77813
commit
911367e6d5
|
@ -24,6 +24,7 @@ run() {
|
||||||
[[ ! "$-" =~ e ]] || e=1
|
[[ ! "$-" =~ e ]] || e=1
|
||||||
set +e
|
set +e
|
||||||
output="$("$@" 2>&1)"
|
output="$("$@" 2>&1)"
|
||||||
|
IFS=$'\n' lines=($output)
|
||||||
status="$?"
|
status="$?"
|
||||||
[ -z "$e" ] || set -e
|
[ -z "$e" ] || set -e
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,3 +19,10 @@ FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures"
|
||||||
[[ $status -eq 0 ]]
|
[[ $status -eq 0 ]]
|
||||||
[[ $output = "1..0" ]]
|
[[ $output = "1..0" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "one passing test" {
|
||||||
|
run bats "$FIXTURE_ROOT/one_passing.bats"
|
||||||
|
[[ $status -eq 0 ]]
|
||||||
|
[[ ${lines[0]} = "1..1" ]]
|
||||||
|
[[ ${lines[1]} = "ok 1 a passing test" ]]
|
||||||
|
}
|
||||||
|
|
3
test/fixtures/one_passing.bats
vendored
Normal file
3
test/fixtures/one_passing.bats
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
@test "a passing test" {
|
||||||
|
true
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user