#!/bin/sh # Runs the tests in this directory. They are package main's own tests, and Go # only compiles those from the package's directory, so an overlay presents # them to the go tool as if they were there. Arguments go to "go test": # # tests/run.sh # tests/run.sh -run TestCorpus -v set -e cd "$(dirname "$0")/.." root=$(pwd) overlay=$(mktemp) trap 'rm -f "$overlay"' EXIT { printf '{"Replace":{' sep= for f in tests/*_test.go; do printf '%s"%s/%s":"%s/%s"' "$sep" "$root" "${f#tests/}" "$root" "$f" sep=, done printf '}}\n' } >"$overlay" go test -overlay "$overlay" "$@" .