From 0ee519ddde58dd4f2f48e24ca00e7e492c1fdfbf Mon Sep 17 00:00:00 2001 From: Mitchell Paulus Date: Tue, 3 Dec 2024 09:34:04 -0600 Subject: [PATCH] Add more awk test cases --- examples/awk/2.msh | 2 +- examples/awk/3.awk | 1 + examples/awk/3.msh | 1 + examples/awk/test.sh | 25 +++++++++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 examples/awk/3.awk create mode 100644 examples/awk/3.msh create mode 100755 examples/awk/test.sh diff --git a/examples/awk/2.msh b/examples/awk/2.msh index 9d74888..84cee92 100644 --- a/examples/awk/2.msh +++ b/examples/awk/2.msh @@ -1 +1 @@ -.. :10: wl +.. :9: wl diff --git a/examples/awk/3.awk b/examples/awk/3.awk new file mode 100644 index 0000000..7af698d --- /dev/null +++ b/examples/awk/3.awk @@ -0,0 +1 @@ +{ print $NF } diff --git a/examples/awk/3.msh b/examples/awk/3.msh new file mode 100644 index 0000000..e32fc3a --- /dev/null +++ b/examples/awk/3.msh @@ -0,0 +1 @@ +wt (:-1: wl) each diff --git a/examples/awk/test.sh b/examples/awk/test.sh new file mode 100755 index 0000000..8499044 --- /dev/null +++ b/examples/awk/test.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +emp_test() { + if diff <(awk -f "$1".awk emp.data) <(mshell "$1".msh < emp.data); then + printf "%s. pass\n" "$1" + else + printf "%s. fail\n" "$1" + FAIL=1 + fi +} + +FAIL=0 + +emp_test 1 + +if diff <(seq 1 20 | awk -f '2.awk' ) <(seq 1 20 | mshell 2.msh); then + printf "2. pass\n" +else + printf "2. fail\n" + FAIL=1 +fi + +emp_test 3 + +exit "$FAIL"