Warning bit fixes to t/op/caller.t
[p5sagit/p5-mst-13.2.git] / t / op / regexp_nc_tie.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6     require './test.pl';
7 }
8
9 # Do a basic test on all the tied methods of Tie::Hash::NamedCapture
10
11 print "1..12\n";
12
13 "hlagh" =~ /
14     (?<a>.)
15     (?<b>.)
16     (?<a>.)
17     .*
18     (?<e>$)
19 /x;
20
21 # FETCH
22 is($+{a}, "h", "FETCH");
23 is($+{b}, "l", "FETCH");
24 is($-{a}[0], "h", "FETCH");
25 is($-{a}[1], "a", "FETCH");
26
27 # STORE
28 eval { $+{a} = "yon" };
29 ok(index($@, "read-only") != -1, "STORE");
30
31 # DELETE
32 eval { delete $+{a} };
33 ok(index($@, "read-only") != -1, "DELETE");
34
35 # CLEAR
36 eval { %+ = () };
37 ok(index($@, "read-only") != -1, "CLEAR");
38
39 # EXISTS
40 ok(exists $+{e}, "EXISTS");
41 ok(!exists $+{d}, "EXISTS");
42
43 # FIRSTKEY/NEXTKEY
44 is(join('|', sort keys %+), "a|b|e", "FIRSTKEY/NEXTKEY");
45
46 # SCALAR
47 is(scalar(%+), 3, "SCALAR");
48 is(scalar(%-), 3, "SCALAR");