mirror of
https://github.com/sstephenson/bats.git
synced 2026-02-25 09:18:10 +01:00
Test that each test's environment is isolated
This commit is contained in:
@@ -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" ]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user