mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 20:19:45 +00:00
27 lines
658 B
Bash
27 lines
658 B
Bash
#!/usr/bin/env bats
|
|
|
|
setup_file() {
|
|
PROJECT_ROOT="$(cd "${BATS_TEST_DIRNAME}/.." && pwd)"
|
|
export PROJECT_ROOT
|
|
}
|
|
|
|
@test "run_with_timeout succeeds without GNU timeout" {
|
|
run bash --noprofile --norc -c '
|
|
set -euo pipefail
|
|
PATH="/usr/bin:/bin"
|
|
source "'"$PROJECT_ROOT"'/lib/common.sh"
|
|
run_with_timeout 1 sleep 0.1
|
|
'
|
|
[ "$status" -eq 0 ]
|
|
}
|
|
|
|
@test "run_with_timeout enforces timeout and returns 124" {
|
|
run bash --noprofile --norc -c '
|
|
set -euo pipefail
|
|
PATH="/usr/bin:/bin"
|
|
source "'"$PROJECT_ROOT"'/lib/common.sh"
|
|
run_with_timeout 1 sleep 5
|
|
'
|
|
[ "$status" -eq 124 ]
|
|
}
|