| Line | |
|---|
| 1 | #!./perl
|
|---|
| 2 |
|
|---|
| 3 | # $RCSfile: elsif.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:08 $
|
|---|
| 4 |
|
|---|
| 5 | sub foo {
|
|---|
| 6 | if ($_[0] == 1) {
|
|---|
| 7 | 1;
|
|---|
| 8 | }
|
|---|
| 9 | elsif ($_[0] == 2) {
|
|---|
| 10 | 2;
|
|---|
| 11 | }
|
|---|
| 12 | elsif ($_[0] == 3) {
|
|---|
| 13 | 3;
|
|---|
| 14 | }
|
|---|
| 15 | else {
|
|---|
| 16 | 4;
|
|---|
| 17 | }
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | print "1..4\n";
|
|---|
| 21 |
|
|---|
| 22 | if (($x = &foo(1)) == 1) {print "ok 1\n";} else {print "not ok 1 '$x'\n";}
|
|---|
| 23 | if (($x = &foo(2)) == 2) {print "ok 2\n";} else {print "not ok 2 '$x'\n";}
|
|---|
| 24 | if (($x = &foo(3)) == 3) {print "ok 3\n";} else {print "not ok 3 '$x'\n";}
|
|---|
| 25 | if (($x = &foo(4)) == 4) {print "ok 4\n";} else {print "not ok 4 '$x'\n";}
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.