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:
parent
2e52aeff5d
commit
098d993eb4
|
@ -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
8
test/fixtures/environment.bats
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
@test "setting a variable" {
|
||||||
|
variable=1
|
||||||
|
[ $variable -eq 1 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "variables do not persist across tests" {
|
||||||
|
[ -z "$variable" ]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user