diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-03-29 07:02:37 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-03-29 07:02:37 -0700 |
commit | 4955c31e0b97fa5d0ac866df2db08bb390845a30 (patch) | |
tree | c1677eb5a2ecc541dedbac516f8910097140ff9f /testcases-case | |
parent | c2287bfb8bdf1648ec2683b1a8e96547fcb43513 (diff) | |
download | cppawk-4955c31e0b97fa5d0ac866df2db08bb390845a30.tar.gz cppawk-4955c31e0b97fa5d0ac866df2db08bb390845a30.tar.bz2 cppawk-4955c31e0b97fa5d0ac866df2db08bb390845a30.zip |
case: add mixed clause.
Diffstat (limited to 'testcases-case')
-rw-r--r-- | testcases-case | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/testcases-case b/testcases-case index 6e62412..4b9fc5e 100644 --- a/testcases-case +++ b/testcases-case @@ -52,3 +52,29 @@ function f(arg, case_temps) BEGIN { print f(1), f(2), f(3), f(4) }' : 10 20 30 -4 +-- +4: +$cppawk ' +#include <case.h> +function f(arg, case_temps, retval) +{ + retval = 0 + + case (arg) { + of ("alt") + ++retval + cfall + mixed (("foo", "bar"), (/^abc/, /xyz$/)) + ++retval + cbreak + otherwise + --retval + cbreak + } + + return retval +} + +BEGIN { print f("alt"), f("foo"), f("bar"), f("abcde"), f("wxyz"), f("1abc2") }' +: +2 1 1 1 1 -1 |