Skip to content

Commit 0ec3619

Browse files
Add test
1 parent 48b0d26 commit 0ec3619

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

test/parallel.bats

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ bats_require_minimum_version 1.5.0
55
load test_helper
66
fixtures parallel
77

8+
# shellcheck disable=SC2034
9+
BATS_TEST_TIMEOUT=10 # only intended for the "short form ..."" test
10+
811
setup() {
912
type -p parallel &>/dev/null || skip "--jobs requires GNU parallel"
1013
(type -p flock &>/dev/null || type -p shlock &>/dev/null) || skip "--jobs requires flock/shlock"
@@ -208,3 +211,10 @@ check_parallel_tests() { # <expected maximum parallelity>
208211
@test "BATS_NO_PARALLELIZE_WITHIN_FILE does not work from inside test function" {
209212
DISABLE_IN_TEST_FUNCTION=1 reentrant_run ! bats --jobs 2 "$FIXTURE_ROOT/must_not_parallelize_within_file.bats"
210213
}
214+
215+
@test "Short form typo does not run endlessly" {
216+
unset BATS_NO_PARALLELIZE_ACROSS_FILES
217+
run bats -j2 "$FIXTURE_ROOT/../bats/passing.bats"
218+
(( SECONDS < 5 ))
219+
[ "${lines[1]}" = 'Invalid number of jobs: -2' ]
220+
}

test/timeout.bats

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ bats_require_minimum_version 1.5.0
2323
[ "${lines[3]}" == "# \`sleep \"\${SLEEP?}\"' failed due to timeout" ]
2424
((SECONDS < 10)) || false
2525
}
26+
27+
@test "sleep in run" {
28+
run sleep 10
29+
}

0 commit comments

Comments
 (0)