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

Test that each test's environment is isolated

This commit is contained in:
Sam Stephenson 2011-12-28 20:23:52 -06:00
parent 2e52aeff5d
commit 098d993eb4
2 changed files with 13 additions and 0 deletions

View File

@ -41,3 +41,8 @@ FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures"
[ ${lines[1]} = "not ok 1 a failing test" ] [ ${lines[1]} = "not ok 1 a failing test" ]
[ ${lines[2]} = "ok 2 a passing test" ] [ ${lines[2]} = "ok 2 a passing test" ]
} }
@test "test environments are isolated" {
run bats "$FIXTURE_ROOT/environment.bats"
[ $status -eq 0 ]
}

8
test/fixtures/environment.bats vendored Normal file
View File

@ -0,0 +1,8 @@
@test "setting a variable" {
variable=1
[ $variable -eq 1 ]
}
@test "variables do not persist across tests" {
[ -z "$variable" ]
}