diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-28 00:01:16 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-28 00:01:16 +0000 |
commit | be709c24d40c2fb52d3f57faa25b9134c7d25270 (patch) | |
tree | 8a2d3d0281ab92d0d961c7a783e01ba501e8a418 /shell/hush_test | |
parent | 8d523cbcd79c5428f1ea5bcbec6b7d9fd3756dc3 (diff) |
hush: finish and enable optional case...esac support. Code size cost:
function old new delta
run_list 1891 2075 +184
parse_stream 1764 1847 +83
expand_strvec_to_string - 83 +83
done_word 647 715 +68
static.reserved_list 144 168 +24
static.reserved_match - 12 +12
done_pipe 95 105 +10
builtin_exit 48 46 -2
builtin_eval 127 54 -73
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 5/2 up/down: 464/-75) Total: 389 bytes
Diffstat (limited to 'shell/hush_test')
-rw-r--r-- | shell/hush_test/hush-misc/case1.right | 13 | ||||
-rwxr-xr-x | shell/hush_test/hush-misc/case1.tests | 17 |
2 files changed, 30 insertions, 0 deletions
diff --git a/shell/hush_test/hush-misc/case1.right b/shell/hush_test/hush-misc/case1.right new file mode 100644 index 000000000..9b88658af --- /dev/null +++ b/shell/hush_test/hush-misc/case1.right @@ -0,0 +1,13 @@ +OK_1 +OK_21 +OK_22 +OK_23 +OK_31 +OK_32 +OK_41 +OK_42 +OK_43 +OK_44 +OK_51 +OK_52 +OK_53 diff --git a/shell/hush_test/hush-misc/case1.tests b/shell/hush_test/hush-misc/case1.tests new file mode 100755 index 000000000..15f60f3a6 --- /dev/null +++ b/shell/hush_test/hush-misc/case1.tests @@ -0,0 +1,17 @@ +case w in a) echo SKIP;; w) echo OK_1;; w) echo WRONG;; esac + +t=w +case $t in a) echo SKIP;; w) echo OK_21;; w) echo WRONG;; esac; +case "$t" in a) echo SKIP;; w) echo OK_22;; w) echo WRONG;; esac; +case w in a) echo SKIP;; $t) echo OK_23;; "$t") echo WRONG;; esac; + +case '' in a) echo SKIP;; w) echo WRONG;; *) echo OK_31;; esac; +case '' in a) echo SKIP;; '') echo OK_32;; *) echo WRONG;; esac; + +case `echo w` in a) echo SKIP;; w) echo OK_41;; w) echo WRONG;; esac; +case "`echo w`" in a) echo SKIP;; w) echo OK_42;; w) echo WRONG;; esac; +case `echo w w` in a) echo SKIP;; w) echo WRONG;; 'w w') echo OK_43;; esac; +case `echo w w` in a) echo SKIP;; w) echo WRONG;; w*) echo OK_44;; esac; + +case w in `echo w`) echo OK_51;; `echo WRONG >&2`w) echo WRONG;; esac; +case w in `echo OK_52 >&2`) echo SKIP;; `echo`w) echo OK_53;; esac; |