From 799c8b0a83ef21c96646096ebebeb1688a5912c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=8B=9C=EC=9B=90?= Date: Sun, 16 Aug 2026 14:02:33 +0900 Subject: [PATCH] test: cover compiler cli tooling --- fec/tests/run-cli-tests.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 fec/tests/run-cli-tests.sh diff --git a/fec/tests/run-cli-tests.sh b/fec/tests/run-cli-tests.sh new file mode 100644 index 0000000..ddecda3 --- /dev/null +++ b/fec/tests/run-cli-tests.sh @@ -0,0 +1,26 @@ +#!/bin/sh +set -eu +root=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd) +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT HUP INT TERM + +"$root"/fec --dump-tokens "$root"/tests/pass/basic.fe >"$tmp/tokens.out" +grep 'unit' "$tmp/tokens.out" >/dev/null +grep 'identifier' "$tmp/tokens.out" >/dev/null +grep 'eof' "$tmp/tokens.out" >/dev/null + +"$root"/fec --check "$root"/tests/m2/hello.fe >"$tmp/check.out" +if [ -s "$tmp/check.out" ]; then + echo "FAIL: --check produced stdout" + exit 1 +fi + +if "$root"/fec --check "$root"/tests/m2/bad-condition.fe >"$tmp/bad.out" 2>"$tmp/diag.out"; then + echo "FAIL: --check accepted invalid input" + exit 1 +fi +grep 'error:' "$tmp/diag.out" >/dev/null +grep '^ [0-9][0-9]* | ' "$tmp/diag.out" >/dev/null +grep ' | .*\^' "$tmp/diag.out" >/dev/null + +echo "CLI tests: token dump, check mode, and source diagnostics passed"