mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 03:32:27 +01:00
parent
1735a4fcd2
commit
5fe46a0893
|
@ -30,13 +30,13 @@ fixtures bats
|
||||||
@test "empty test file runs zero tests" {
|
@test "empty test file runs zero tests" {
|
||||||
run bats "$FIXTURE_ROOT/empty.bats"
|
run bats "$FIXTURE_ROOT/empty.bats"
|
||||||
[ $status -eq 0 ]
|
[ $status -eq 0 ]
|
||||||
[ $output = "1..0" ]
|
[ "$output" = "1..0" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "one passing test" {
|
@test "one passing test" {
|
||||||
run bats "$FIXTURE_ROOT/passing.bats"
|
run bats "$FIXTURE_ROOT/passing.bats"
|
||||||
[ $status -eq 0 ]
|
[ $status -eq 0 ]
|
||||||
[ ${lines[0]} = "1..1" ]
|
[ "${lines[0]}" = "1..1" ]
|
||||||
[ "${lines[1]}" = "ok 1 a passing test" ]
|
[ "${lines[1]}" = "ok 1 a passing test" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,30 +6,30 @@ fixtures suite
|
||||||
@test "running a suite with no test files" {
|
@test "running a suite with no test files" {
|
||||||
run bats "$FIXTURE_ROOT/empty"
|
run bats "$FIXTURE_ROOT/empty"
|
||||||
[ $status -eq 0 ]
|
[ $status -eq 0 ]
|
||||||
[ $output = "1..0" ]
|
[ "$output" = "1..0" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "running a suite with one test file" {
|
@test "running a suite with one test file" {
|
||||||
run bats "$FIXTURE_ROOT/single"
|
run bats "$FIXTURE_ROOT/single"
|
||||||
[ $status -eq 0 ]
|
[ $status -eq 0 ]
|
||||||
[ ${lines[0]} = "1..1" ]
|
[ "${lines[0]}" = "1..1" ]
|
||||||
[ "${lines[1]}" = "ok 1 a passing test" ]
|
[ "${lines[1]}" = "ok 1 a passing test" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "counting tests in a suite" {
|
@test "counting tests in a suite" {
|
||||||
run bats -c "$FIXTURE_ROOT/single"
|
run bats -c "$FIXTURE_ROOT/single"
|
||||||
[ $status -eq 0 ]
|
[ $status -eq 0 ]
|
||||||
[ $output -eq 1 ]
|
[ "$output" -eq 1 ]
|
||||||
|
|
||||||
run bats -c "$FIXTURE_ROOT/multiple"
|
run bats -c "$FIXTURE_ROOT/multiple"
|
||||||
[ $status -eq 0 ]
|
[ $status -eq 0 ]
|
||||||
[ $output -eq 3 ]
|
[ "$output" -eq 3 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "aggregated output of multiple tests in a suite" {
|
@test "aggregated output of multiple tests in a suite" {
|
||||||
run bats "$FIXTURE_ROOT/multiple"
|
run bats "$FIXTURE_ROOT/multiple"
|
||||||
[ $status -eq 0 ]
|
[ $status -eq 0 ]
|
||||||
[ ${lines[0]} = "1..3" ]
|
[ "${lines[0]}" = "1..3" ]
|
||||||
echo "$output" | grep "^ok . truth"
|
echo "$output" | grep "^ok . truth"
|
||||||
echo "$output" | grep "^ok . more truth"
|
echo "$output" | grep "^ok . more truth"
|
||||||
echo "$output" | grep "^ok . quasi-truth"
|
echo "$output" | grep "^ok . quasi-truth"
|
||||||
|
@ -38,14 +38,14 @@ fixtures suite
|
||||||
@test "a failing test in a suite results in an error exit code" {
|
@test "a failing test in a suite results in an error exit code" {
|
||||||
FLUNK=1 run bats "$FIXTURE_ROOT/multiple"
|
FLUNK=1 run bats "$FIXTURE_ROOT/multiple"
|
||||||
[ $status -eq 1 ]
|
[ $status -eq 1 ]
|
||||||
[ ${lines[0]} = "1..3" ]
|
[ "${lines[0]}" = "1..3" ]
|
||||||
echo "$output" | grep "^not ok . quasi-truth"
|
echo "$output" | grep "^not ok . quasi-truth"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "running an ad-hoc suite by specifying multiple test files" {
|
@test "running an ad-hoc suite by specifying multiple test files" {
|
||||||
run bats "$FIXTURE_ROOT/multiple/a.bats" "$FIXTURE_ROOT/multiple/b.bats"
|
run bats "$FIXTURE_ROOT/multiple/a.bats" "$FIXTURE_ROOT/multiple/b.bats"
|
||||||
[ $status -eq 0 ]
|
[ $status -eq 0 ]
|
||||||
[ ${lines[0]} = "1..3" ]
|
[ "${lines[0]}" = "1..3" ]
|
||||||
echo "$output" | grep "^ok . truth"
|
echo "$output" | grep "^ok . truth"
|
||||||
echo "$output" | grep "^ok . more truth"
|
echo "$output" | grep "^ok . more truth"
|
||||||
echo "$output" | grep "^ok . quasi-truth"
|
echo "$output" | grep "^ok . quasi-truth"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user