diff --git a/test/bats.bats b/test/bats.bats index 5f5b510..0eec271 100755 --- a/test/bats.bats +++ b/test/bats.bats @@ -41,3 +41,8 @@ FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures" [ ${lines[1]} = "not ok 1 a failing test" ] [ ${lines[2]} = "ok 2 a passing test" ] } + +@test "test environments are isolated" { + run bats "$FIXTURE_ROOT/environment.bats" + [ $status -eq 0 ] +} diff --git a/test/fixtures/environment.bats b/test/fixtures/environment.bats new file mode 100644 index 0000000..8d3b984 --- /dev/null +++ b/test/fixtures/environment.bats @@ -0,0 +1,8 @@ +@test "setting a variable" { + variable=1 + [ $variable -eq 1 ] +} + +@test "variables do not persist across tests" { + [ -z "$variable" ] +}