1
0
mirror of https://github.com/sstephenson/bats.git synced 2026-02-26 09:48:10 +01:00

Suite support for aggregating multiple tests under a single run

This commit is contained in:
Sam Stephenson
2012-11-16 14:25:45 -06:00
parent f8f78b5cd3
commit 19a05cc77d
18 changed files with 120 additions and 7 deletions

0
test/fixtures/bats/empty.bats vendored Normal file
View File

8
test/fixtures/bats/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" ]
}

3
test/fixtures/bats/failing.bats vendored Normal file
View File

@@ -0,0 +1,3 @@
@test "a failing test" {
false
}

View File

@@ -0,0 +1,7 @@
@test "a failing test" {
false
}
@test "a passing test" {
true
}

5
test/fixtures/bats/load.bats vendored Normal file
View File

@@ -0,0 +1,5 @@
load test_helper
@test "calling a loaded helper" {
help_me
}

19
test/fixtures/bats/output.bats vendored Normal file
View File

@@ -0,0 +1,19 @@
@test "success writing to stdout" {
echo "success stdout 1"
echo "success stdout 2"
}
@test "success writing to stderr" {
echo "success stderr" >&2
}
@test "failure writing to stdout" {
echo "failure stdout 1"
echo "failure stdout 2"
false
}
@test "failure writing to stderr" {
echo "failure stderr" >&2
false
}

3
test/fixtures/bats/passing.bats vendored Normal file
View File

@@ -0,0 +1,3 @@
@test "a passing test" {
true
}

17
test/fixtures/bats/setup.bats vendored Normal file
View File

@@ -0,0 +1,17 @@
LOG="$TMP/setup.log"
setup() {
echo "$BATS_TEST_NAME" >> "$LOG"
}
@test "one" {
[ "$(tail -n 1 "$LOG")" = "test_one" ]
}
@test "two" {
[ "$(tail -n 1 "$LOG")" = "test_two" ]
}
@test "three" {
[ "$(tail -n 1 "$LOG")" = "test_three" ]
}

17
test/fixtures/bats/teardown.bats vendored Normal file
View File

@@ -0,0 +1,17 @@
LOG="$TMP/teardown.log"
teardown() {
echo "$BATS_TEST_NAME" >> "$LOG"
}
@test "one" {
true
}
@test "two" {
false
}
@test "three" {
true
}

3
test/fixtures/bats/test_helper.bash vendored Normal file
View File

@@ -0,0 +1,3 @@
help_me() {
true
}