mirror of
https://github.com/sstephenson/bats.git
synced 2026-02-25 09:18:10 +01:00
Test (and fix) that teardown runs once after each test
This commit is contained in:
10
test/fixtures/setup.bats
vendored
10
test/fixtures/setup.bats
vendored
@@ -1,15 +1,17 @@
|
||||
LOG="$TMP/setup.log"
|
||||
|
||||
setup() {
|
||||
echo "$BATS_TEST_NAME" >> "$TMP/setup.log"
|
||||
echo "$BATS_TEST_NAME" >> "$LOG"
|
||||
}
|
||||
|
||||
@test "one" {
|
||||
true
|
||||
[ "$(tail -n 1 "$LOG")" = "test_one" ]
|
||||
}
|
||||
|
||||
@test "two" {
|
||||
true
|
||||
[ "$(tail -n 1 "$LOG")" = "test_two" ]
|
||||
}
|
||||
|
||||
@test "three" {
|
||||
true
|
||||
[ "$(tail -n 1 "$LOG")" = "test_three" ]
|
||||
}
|
||||
|
||||
17
test/fixtures/teardown.bats
vendored
Normal file
17
test/fixtures/teardown.bats
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
LOG="$TMP/teardown.log"
|
||||
|
||||
teardown() {
|
||||
echo "$BATS_TEST_NAME" >> "$LOG"
|
||||
}
|
||||
|
||||
@test "one" {
|
||||
true
|
||||
}
|
||||
|
||||
@test "two" {
|
||||
false
|
||||
}
|
||||
|
||||
@test "three" {
|
||||
true
|
||||
}
|
||||
Reference in New Issue
Block a user