Skip to content

Commit

Permalink
Add more awk test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchpaulus committed Dec 3, 2024
1 parent 49ce489 commit 0ee519d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/awk/2.msh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.. :10: wl
.. :9: wl
1 change: 1 addition & 0 deletions examples/awk/3.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ print $NF }
1 change: 1 addition & 0 deletions examples/awk/3.msh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wt (:-1: wl) each
25 changes: 25 additions & 0 deletions examples/awk/test.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 0ee519d

Please sign in to comment.