Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-schulze-vireso committed Oct 5, 2022
1 parent 48b0d26 commit d7c504a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/parallel.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ bats_require_minimum_version 1.5.0
load test_helper
fixtures parallel

BATS_TEST_TIMEOUT=10 # only intended for the short form test

setup() {
type -p parallel &>/dev/null || skip "--jobs requires GNU parallel"
(type -p flock &>/dev/null || type -p shlock &>/dev/null) || skip "--jobs requires flock/shlock"
Expand Down Expand Up @@ -208,3 +210,9 @@ check_parallel_tests() { # <expected maximum parallelity>
@test "BATS_NO_PARALLELIZE_WITHIN_FILE does not work from inside test function" {
DISABLE_IN_TEST_FUNCTION=1 reentrant_run ! bats --jobs 2 "$FIXTURE_ROOT/must_not_parallelize_within_file.bats"
}

@test "Short form typo does not run endlessly" {
run bats -j2 "$FIXTURE_ROOT/../bats/passing.bats"
(( SECONDS < 5 ))
[ "${lines[1]}" = 'Invalid number of jobs: -2' ]
}

0 comments on commit d7c504a

Please sign in to comment.