From 992287bc1fcd97ebf9b1fea519d4694f2f8fcebf Mon Sep 17 00:00:00 2001 From: Roman Volovoy Date: Wed, 3 Jun 2026 17:04:29 +0200 Subject: [PATCH] based tests --- aliases | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/aliases b/aliases index 464416a..2ef8c7d 100644 --- a/aliases +++ b/aliases @@ -20,7 +20,7 @@ cc-run(){ cc-clean } -cc-run-test(){ +cc-run-test-inline(){ local file if [ -z "$1" ]; then echo "Usage: cc-run [args...]" >&2 @@ -43,6 +43,32 @@ cc-run-test(){ cc-clean } +cc-run-test(){ + local file + if [ -z "$1" ]; then + echo "Usage: cc-run [args...]" >&2 + return 1 + fi + + cc-clean + + file="$1" + shift + + # remove trailing .c if present + base="${file%.*}" + + if command -v norminette &>/dev/null; then + norminette "${base}.c" + fi + + # compile base.test.c -> base.test.out and run it + cc -std=c99 "${base}.test.c" -o "${base}.test.out" -Wall -Wextra -Werror && + "./${base}.test.out" "$@" + + cc-clean +} + cc-run-lax(){ local file