#!/usr/bin/env bash # Usage: ./test.sh [MNN] (no arg = all tests) # A module tag selects exactly that module's test files: test/MNN*.test.scala, so M07 runs M07IO but not # M07bSafeIO, and M07b runs only M07bSafeIO. Each file gives one munit glob, `**`, matching its suite. set -euo pipefail cd "$(dirname "$0")" SCALA_CLI="${SCALA_CLI:-$(command -v scala-cli || echo "$HOME/.local/bin/scala-cli")}" if [ $# -ge 1 ]; then globs=() for f in test/"$1"[[:upper:]]*.test.scala; do [ -e "$f" ] || continue name="$(basename "$f" .test.scala)" globs+=("*$name*") done [ ${#globs[@]} -gt 0 ] || globs=("*$1*") # no test file for this tag: keep the old behaviour exec "$SCALA_CLI" test src test project.scala -- "${globs[@]}" else exec "$SCALA_CLI" test src test project.scala fi