diff options
Diffstat (limited to 't/cmd.elsif')
-rw-r--r-- | t/cmd.elsif | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/t/cmd.elsif b/t/cmd.elsif new file mode 100644 index 0000000000..51a7641d08 --- /dev/null +++ b/t/cmd.elsif @@ -0,0 +1,25 @@ +#!./perl + +# $Header: cmd.elsif,v 1.0 87/12/18 13:12:02 root Exp $ + +sub foo { + if ($_[0] == 1) { + 1; + } + elsif ($_[0] == 2) { + 2; + } + elsif ($_[0] == 3) { + 3; + } + else { + 4; + } +} + +print "1..4\n"; + +if (($x = do foo(1)) == 1) {print "ok 1\n";} else {print "not ok 1\n";} +if (($x = do foo(2)) == 2) {print "ok 2\n";} else {print "not ok 2\n";} +if (($x = do foo(3)) == 3) {print "ok 3\n";} else {print "not ok 3\n";} +if (($x = do foo(4)) == 4) {print "ok 4\n";} else {print "not ok 4\n";} |