1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-12-27 06:59:45 +01:00

Add $lines array

This commit is contained in:
Sam Stephenson 2011-12-28 17:12:37 -06:00
parent 4a71d77813
commit 911367e6d5
3 changed files with 11 additions and 0 deletions

View File

@ -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
} }

View File

@ -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
View File

@ -0,0 +1,3 @@
@test "a passing test" {
true
}