1
0
mirror of https://github.com/sstephenson/bats.git synced 2024-11-17 03:32:27 +01:00

[[ isn't a simple command and thus isn't subject to set -e

This commit is contained in:
Sam Stephenson 2011-12-28 18:25:05 -06:00
parent 911367e6d5
commit 974dbf6a7c

View File

@ -4,25 +4,25 @@ FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures"
@test "no arguments prints usage instructions" { @test "no arguments prints usage instructions" {
run bats run bats
[[ $status -eq 1 ]] [ $status -eq 1 ]
[[ $output =~ ^usage: ]] [ $(expr "$output" : "usage:") -ne 0 ]
} }
@test "invalid filename prints an error" { @test "invalid filename prints an error" {
run bats nonexistent run bats nonexistent
[[ $status -eq 1 ]] [ $status -eq 1 ]
[[ $output =~ does\ not\ exist ]] [ $(expr "$output" : ".*does not exist") -ne 0 ]
} }
@test "empty test file runs zero tests" { @test "empty test file runs zero tests" {
run bats "$FIXTURE_ROOT/empty.bats" run bats "$FIXTURE_ROOT/empty.bats"
[[ $status -eq 0 ]] [ $status -eq 0 ]
[[ $output = "1..0" ]] [ $output = "1..0" ]
} }
@test "one passing test" { @test "one passing test" {
run bats "$FIXTURE_ROOT/one_passing.bats" run bats "$FIXTURE_ROOT/one_passing.bats"
[[ $status -eq 0 ]] [ $status -eq 0 ]
[[ ${lines[0]} = "1..1" ]] [ ${lines[0]} = "1..1" ]
[[ ${lines[1]} = "ok 1 a passing test" ]] [ ${lines[1]} = "ok 1 a passing test" ]
} }