diff options
| author | Toby Goodwin <toby@nqmail.org> | 2018-08-19 22:29:03 +0100 |
|---|---|---|
| committer | Toby Goodwin <toby@nqmail.org> | 2018-08-19 22:29:03 +0100 |
| commit | 3f4dfc08e2ca5dc37260dee2bc7d1fb6c5f9ff96 (patch) | |
| tree | 9e9a4f294806441b2fc4f2d727cc0f21f9360765 /trip.rc | |
| parent | 9c6211258c808637d6a71430b191841f0c50ed25 (diff) | |
add failing test for else / if not case
Diffstat (limited to 'trip.rc')
| -rw-r--r-- | trip.rc | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -708,16 +708,9 @@ if (~ $status 0) { 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' +submatch 'if (false) { echo foo } else echo qux; if not echo bar' 'rc: `if not'' must follow `if''' 'if not 4' -# 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' -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 +# if-not stack if_state regression s=' L=() if (true) { @@ -734,3 +727,11 @@ m=`{$rc -c $s} if (! ~ $^m a2) { fail '"if not" not correct' } + +# 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' +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' |