summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrazen Borkovic <dborkov@amazon.com>2018-08-04 17:28:00 -0700
committerToby Goodwin <toby@nqmail.org>2018-08-08 22:48:17 +0100
commit674875fe55afd5f76f0f4dab3555ff283928545a (patch)
tree09734ea7021bae93798998bf53faf08eb0bbc55c
parent30b5d93c057e582d10577796fe5fe296b4498ac2 (diff)
Test for if-not issue
-rw-r--r--trip.rc25
1 files changed, 25 insertions, 0 deletions
diff --git a/trip.rc b/trip.rc
index 7288ea2..747ad22 100644
--- a/trip.rc
+++ b/trip.rc
@@ -716,3 +716,28 @@ submatch 'flag xx' 'usage: flag f [ + | - ]' 'flag wrong first arg'
submatch 'flag x x' 'usage: flag f [ + | - ]' 'flag wrong second arg'
submatch 'flag c && echo yes' yes 'flag c'
submatch 'flag x +; flag x -' 'flag x -' 'setting x flag'
+
+# if-not stack if_state check
+ss=(
+ 'L=()'
+ 'if (true) {'
+ ' if (false) {'
+ ' L=($L a1)'
+ ' }'
+ ' if not L=($L a2)'
+ '}'
+ 'if not L=($L a3)'
+ 'echo $L'
+)
+
+s=''
+for (a in $ss) {
+ s=$s$a$nl
+}
+m=`{$rc -c $s}
+whatis -v s m
+if (! ~ $^m a2) {
+ fail '"if not" not correct'
+}
+
+