Commit | Line | Data |
29569577 |
1 | #!/usr/bin/perl -Tw |
2 | |
3 | BEGIN { |
4 | if( $ENV{PERL_CORE} ) { |
5 | @INC = '../lib'; |
6 | chdir 't'; |
7 | } |
8 | } |
9 | |
14a976d6 |
10 | use Test::More tests => 33; |
29569577 |
11 | |
12 | my $foo; |
14a976d6 |
13 | my @foo; |
14 | my %foo; |
29569577 |
15 | |
16 | ok( !Internals::SvREADONLY $foo ); |
17 | ok( Internals::SvREADONLY $foo, 1 ); |
18 | ok( Internals::SvREADONLY $foo ); |
19 | ok( !Internals::SvREADONLY $foo, 0 ); |
20 | ok( !Internals::SvREADONLY $foo ); |
21 | |
22 | ok( !Internals::SvREADONLY @foo ); |
23 | ok( Internals::SvREADONLY @foo, 1 ); |
24 | ok( Internals::SvREADONLY @foo ); |
25 | ok( !Internals::SvREADONLY @foo, 0 ); |
26 | ok( !Internals::SvREADONLY @foo ); |
27 | |
28 | ok( !Internals::SvREADONLY $foo[2] ); |
29 | ok( Internals::SvREADONLY $foo[2], 1 ); |
30 | ok( Internals::SvREADONLY $foo[2] ); |
31 | ok( !Internals::SvREADONLY $foo[2], 0 ); |
32 | ok( !Internals::SvREADONLY $foo[2] ); |
33 | |
34 | ok( !Internals::SvREADONLY %foo ); |
35 | ok( Internals::SvREADONLY %foo, 1 ); |
36 | ok( Internals::SvREADONLY %foo ); |
37 | ok( !Internals::SvREADONLY %foo, 0 ); |
38 | ok( !Internals::SvREADONLY %foo ); |
39 | |
40 | ok( !Internals::SvREADONLY $foo{foo} ); |
41 | ok( Internals::SvREADONLY $foo{foo}, 1 ); |
42 | ok( Internals::SvREADONLY $foo{foo} ); |
43 | ok( !Internals::SvREADONLY $foo{foo}, 0 ); |
44 | ok( !Internals::SvREADONLY $foo{foo} ); |
45 | |
46 | is( Internals::SvREFCNT($foo), 1 ); |
47 | { |
48 | my $bar = \$foo; |
49 | is( Internals::SvREFCNT($foo), 2 ); |
50 | is( Internals::SvREFCNT($bar), 1 ); |
51 | } |
52 | is( Internals::SvREFCNT($foo), 1 ); |
53 | |
14a976d6 |
54 | is( Internals::SvREFCNT(@foo), 1 ); |
55 | is( Internals::SvREFCNT($foo[2]), 1 ); |
56 | is( Internals::SvREFCNT(%foo), 1 ); |
57 | is( Internals::SvREFCNT($foo{foo}), 1 ); |
58 | |