diff --git a/tests/run-tests.bats b/tests/run-tests.bats deleted file mode 100644 index ac04b3d..0000000 --- a/tests/run-tests.bats +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env bats - -REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)" -RUN_TESTS="$REPO_ROOT/tests/run-tests.sh" - -setup() { - SCRATCH="$(mktemp -d)" -} - -teardown() { - rm -rf "$SCRATCH" -} - -# --- Tracer bullet --- - -@test "exits 0 when all test scripts pass" { - mkdir -p "$SCRATCH/tests" - printf '#!/usr/bin/env bash\necho "ok"\n' > "$SCRATCH/tests/test-one.sh" - chmod +x "$SCRATCH/tests/test-one.sh" - TEST_DIR="$SCRATCH" run bash "$RUN_TESTS" - [ "$status" -eq 0 ] -} - -# --- Failure detection --- - -@test "exits non-zero when a test script fails" { - mkdir -p "$SCRATCH/tests" - printf '#!/usr/bin/env bash\nexit 1\n' > "$SCRATCH/tests/test-bad.sh" - chmod +x "$SCRATCH/tests/test-bad.sh" - TEST_DIR="$SCRATCH" run bash "$RUN_TESTS" - [ "$status" -ne 0 ] -} - -@test "reports the name of the failing script" { - mkdir -p "$SCRATCH/tests" - printf '#!/usr/bin/env bash\nexit 1\n' > "$SCRATCH/tests/test-bad.sh" - chmod +x "$SCRATCH/tests/test-bad.sh" - TEST_DIR="$SCRATCH" run bash "$RUN_TESTS" - [[ "$output" == *"test-bad.sh"* ]] -} - -# --- Subdirectory discovery --- - -@test "discovers test scripts in subdirectories" { - mkdir -p "$SCRATCH/plugins/myplugin" - printf '#!/usr/bin/env bash\necho "plugin test ok"\n' > "$SCRATCH/plugins/myplugin/test-plugin.sh" - chmod +x "$SCRATCH/plugins/myplugin/test-plugin.sh" - TEST_DIR="$SCRATCH" run bash "$RUN_TESTS" - [ "$status" -eq 0 ] - [[ "$output" == *"test-plugin.sh"* ]] -} - -@test "does not pick up scripts not named test-*.sh" { - mkdir -p "$SCRATCH/tests" - printf '#!/usr/bin/env bash\nexit 1\n' > "$SCRATCH/tests/run-bats.sh" - chmod +x "$SCRATCH/tests/run-bats.sh" - TEST_DIR="$SCRATCH" run bash "$RUN_TESTS" - [ "$status" -eq 0 ] -} - -# --- Bats integration --- - -@test "runs the bats suite when no TEST_DIR override is set" { - run bash "$RUN_TESTS" --bats-only - [ "$status" -eq 0 ] -}