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 0ec3619
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/parallel.bats
Expand Up @@ -5,6 +5,9 @@ bats_require_minimum_version 1.5.0
load test_helper
fixtures parallel

# shellcheck disable=SC2034
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 +211,10 @@ 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" {
unset BATS_NO_PARALLELIZE_ACROSS_FILES
run bats -j2 "$FIXTURE_ROOT/../bats/passing.bats"
(( SECONDS < 5 ))
[ "${lines[1]}" = 'Invalid number of jobs: -2' ]
}
4 changes: 4 additions & 0 deletions test/timeout.bats
Expand Up @@ -23,3 +23,7 @@ bats_require_minimum_version 1.5.0
[ "${lines[3]}" == "# \`sleep \"\${SLEEP?}\"' failed due to timeout" ]
((SECONDS < 10)) || false
}

@test "sleep in run" {
run sleep 10
}

0 comments on commit 0ec3619

Please sign in to comment.