summaryrefslogtreecommitdiff
path: root/trip.rc
diff options
context:
space:
mode:
Diffstat (limited to 'trip.rc')
-rw-r--r--trip.rc12
1 files changed, 10 insertions, 2 deletions
diff --git a/trip.rc b/trip.rc
index e3c48b7..112ba41 100644
--- a/trip.rc
+++ b/trip.rc
@@ -17,8 +17,11 @@ fn expect {
fn submatch {
if (!~ $#* 3)
fail incorrect invocation of submatch
- prompt=$nl if (!~ `` $nl {$rc -ic $1>[2=1]} $2)
+ got = `` $nl { prompt=$nl $rc -ic $1>[2=1] }
+ if (!~ $got $2) {
+ echo got $got expected $2
fail $3
+ }
}
fn sigexit sigint sigquit sigsegv
fn sigexit {
@@ -675,7 +678,7 @@ if (!~ $^L 'a c e f') {
}
# test support for unquoted =
-submatch 'echo foo = bar' 'foo = bar' 'unquoted equals 2'
+submatch 'echo foo = bar' 'foo = bar' 'unquoted equals 1'
submatch 'echo foo=bar' 'foo=bar' 'unquoted equals 2'
submatch 'echo foo=' 'foo=' 'unquoted equals 3'
submatch 'echo =bar; whatis -v echo' 'echo=bar' 'unquoted equals 4'
@@ -701,6 +704,11 @@ if (~ $status 0) {
fail '"rc -e" exits with zero status when backquote command returns non-zero'
}
+# exercise "if not"
+submatch 'if (false) echo foo; if not echo bar' 'bar' 'if not 1'
+submatch 'if (false) echo -n foo; if not echo -n bar; echo qux' 'barqux' 'if not 2'
+submatch 'if (false) echo foo; echo qux; if not echo bar' 'rc: `if not'' must follow `if''' 'if not 3'
+
# exercise flag builtin
submatch 'flag' 'rc: not enough arguments to flag' 'flag no args'
submatch 'flag a b c' 'usage: flag f [ + | - ]' 'flag 3 args'