source: trunk/essentials/sys-apps/gawk/test/gnureops.awk

Last change on this file was 3076, checked in by bird, 18 years ago

gawk 3.1.5

File size: 1.5 KB
Line 
1# test the gnu regexp ops
2
3BEGIN {
4 if ("a rat is here" ~ /\yrat/) print "test 1 ok (\\y)"
5 else print "test 1 failed (\\y)"
6 if ("a rat is here" ~ /rat\y/) print "test 2 ok (\\y)"
7 else print "test 2 failed (\\y)"
8 if ("what a brat" !~ /\yrat/) print "test 3 ok (\\y)"
9 else print "test 3 failed (\\y)"
10
11 if ("in the crate" ~ /\Brat/) print "test 4 ok (\\B)"
12 else print "test 4 failed (\\B)"
13 if ("a rat" !~ /\Brat/) print "test 5 ok (\\B)"
14 else print "test 5 failed (\\B)"
15
16 if ("a word" ~ /\<word/) print "test 6 ok (\\<)"
17 else print "test 6 failed (\\<)"
18 if ("foreword" !~ /\<word/) print "test 7 ok (\\<)"
19 else print "test 7 failed (\\<)"
20
21 if ("a word" ~ /word\>/) print "test 8 ok (\\>)"
22 else print "test 8 failed (\\\\>)"
23 if ("wordy" !~ /word\>/) print "test 9 ok (\\>)"
24 else print "test 9 failed (\\>)"
25
26 if ("a" ~ /\w/) print "test 10 ok (\\w)"
27 else print "test 10 failed (\\\\w)"
28 if ("+" !~ /\w/) print "test 11 ok (\\w)"
29 else print "test 11 failed (\\w)"
30
31 if ("a" !~ /\W/) print "test 12 ok (\\W)"
32 else print "test 12 failed (\\W)"
33 if ("+" ~ /\W/) print "test 13 ok (\\W)"
34 else print "test 13 failed (\\W)"
35
36 if ("a" ~ /\`a/) print "test 14 ok (\\`)"
37 else print "test 14 failed (\\`)"
38 if ("b" !~ /\`a/) print "test 15 ok (\\`)"
39 else print "test 15 failed (\\`)"
40
41 if ("a" ~ /a\'/) print "test 16 ok (\\')"
42 else print "test 16 failed (\\')"
43 if ("b" !~ /a\'/) print "test 17 ok (\\')"
44 else print "test 17 failed (\\')"
45}
Note: See TracBrowser for help on using the repository browser.