Commit | Line | Data |
8d063cd8 |
1 | #!./perl |
2 | |
3 | # $Header: op.pat,v 1.0 87/12/18 13:14:07 root Exp $ |
4 | print "1..22\n"; |
5 | |
6 | $x = "abc\ndef\n"; |
7 | |
8 | if ($x =~ /^abc/) {print "ok 1\n";} else {print "not ok 1\n";} |
9 | if ($x !~ /^def/) {print "ok 2\n";} else {print "not ok 2\n";} |
10 | |
11 | $* = 1; |
12 | if ($x =~ /^def/) {print "ok 3\n";} else {print "not ok 3\n";} |
13 | $* = 0; |
14 | |
15 | $_ = '123'; |
16 | if (/^([0-9][0-9]*)/) {print "ok 4\n";} else {print "not ok 4\n";} |
17 | |
18 | if ($x =~ /^xxx/) {print "not ok 5\n";} else {print "ok 5\n";} |
19 | if ($x !~ /^abc/) {print "not ok 6\n";} else {print "ok 6\n";} |
20 | |
21 | if ($x =~ /def/) {print "ok 7\n";} else {print "not ok 7\n";} |
22 | if ($x !~ /def/) {print "not ok 8\n";} else {print "ok 8\n";} |
23 | |
24 | if ($x !~ /.def/) {print "ok 9\n";} else {print "not ok 9\n";} |
25 | if ($x =~ /.def/) {print "not ok 10\n";} else {print "ok 10\n";} |
26 | |
27 | if ($x =~ /\ndef/) {print "ok 11\n";} else {print "not ok 11\n";} |
28 | if ($x !~ /\ndef/) {print "not ok 12\n";} else {print "ok 12\n";} |
29 | |
30 | $_ = 'aaabbbccc'; |
31 | if (/(a*b*)(c*)/ && $1 eq 'aaabbb' && $2 eq 'ccc') { |
32 | print "ok 13\n"; |
33 | } else { |
34 | print "not ok 13\n"; |
35 | } |
36 | if (/(a+b+c+)/ && $1 eq 'aaabbbccc') { |
37 | print "ok 14\n"; |
38 | } else { |
39 | print "not ok 14\n"; |
40 | } |
41 | |
42 | if (/a+b?c+/) {print "not ok 15\n";} else {print "ok 15\n";} |
43 | |
44 | $_ = 'aaabccc'; |
45 | if (/a+b?c+/) {print "ok 16\n";} else {print "not ok 16\n";} |
46 | if (/a*b+c*/) {print "ok 17\n";} else {print "not ok 17\n";} |
47 | |
48 | $_ = 'aaaccc'; |
49 | if (/a*b?c*/) {print "ok 18\n";} else {print "not ok 18\n";} |
50 | if (/a*b+c*/) {print "not ok 19\n";} else {print "ok 19\n";} |
51 | |
52 | $_ = 'abcdef'; |
53 | if (/bcd|xyz/) {print "ok 20\n";} else {print "not ok 20\n";} |
54 | if (/xyz|bcd/) {print "ok 21\n";} else {print "not ok 21\n";} |
55 | |
56 | if (m|bc/*d|) {print "ok 22\n";} else {print "not ok 22\n";} |