From 390fa7bbf39eaf86d53c6842ad99ed7829a51cf8 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 25 Dec 2020 22:22:48 -0600 Subject: toysh fixes and tests --- tests/sh.test | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/sh.test b/tests/sh.test index 67921c1a..1d021acd 100644 --- a/tests/sh.test +++ b/tests/sh.test @@ -107,6 +107,9 @@ testing 'default exports' \ testing "leading assignment fail" \ "{ \$SH -c 'X=\${a?blah} > walroid';ls walroid;} 2>/dev/null" '' '' '' +testing "lineno" "$SH input" "5 one\n6 one\n5 two\n6 two\n" \ + '#!/bin/bash\n\nfor i in one two\ndo\n echo $LINENO $i\n echo $LINENO $i\ndone\n' "" + ######################################################################### # Change EVAL to call sh -c for us, using "bash" explicitly for the host. export EVAL="$SH -c" @@ -191,6 +194,8 @@ testing 'wildcards' 'echo w[v-x]w w[x-v]w abc/*/ghi' \ testing '$(( ) )' 'echo ab$((echo hello) | tr e x)cd' "abhxllocd\n" "" "" testing '$((x=y)) lifetime' 'a=boing; echo $a $a$((a=4))$a $a' 'boing boing44 4\n' '' '' +testing 'quote' "echo \"'\"" "'\n" "" "" + # Loops and flow control testing "case" 'for i in A C J B; do case "$i" in A) echo got A ;; B) echo and B ;; C) echo then C ;; *) echo default ;; esac; done' \ "got A\nthen C\ndefault\nand B\n" "" "" -- cgit v1.2.3