diff --git a/libexec/bats-exec b/libexec/bats-exec index d062732..913120b 100755 --- a/libexec/bats-exec +++ b/libexec/bats-exec @@ -24,6 +24,7 @@ run() { [[ ! "$-" =~ e ]] || e=1 set +e output="$("$@" 2>&1)" + IFS=$'\n' lines=($output) status="$?" [ -z "$e" ] || set -e } diff --git a/test/bats.bats b/test/bats.bats index bcab33f..c168279 100755 --- a/test/bats.bats +++ b/test/bats.bats @@ -19,3 +19,10 @@ FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures" [[ $status -eq 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" ]] +} diff --git a/test/fixtures/one_passing.bats b/test/fixtures/one_passing.bats new file mode 100644 index 0000000..e8182ce --- /dev/null +++ b/test/fixtures/one_passing.bats @@ -0,0 +1,3 @@ +@test "a passing test" { + true +}