diff options
Diffstat (limited to 'lib/Internals.t')
-rw-r--r-- | lib/Internals.t | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/Internals.t b/lib/Internals.t new file mode 100644 index 0000000000..1f514fd344 --- /dev/null +++ b/lib/Internals.t @@ -0,0 +1,51 @@ +#!/usr/bin/perl -Tw + +BEGIN { + if( $ENV{PERL_CORE} ) { + @INC = '../lib'; + chdir 't'; + } +} + +use Test::More tests => 29; + +my $foo; + +ok( !Internals::SvREADONLY $foo ); +ok( Internals::SvREADONLY $foo, 1 ); +ok( Internals::SvREADONLY $foo ); +ok( !Internals::SvREADONLY $foo, 0 ); +ok( !Internals::SvREADONLY $foo ); + +ok( !Internals::SvREADONLY @foo ); +ok( Internals::SvREADONLY @foo, 1 ); +ok( Internals::SvREADONLY @foo ); +ok( !Internals::SvREADONLY @foo, 0 ); +ok( !Internals::SvREADONLY @foo ); + +ok( !Internals::SvREADONLY $foo[2] ); +ok( Internals::SvREADONLY $foo[2], 1 ); +ok( Internals::SvREADONLY $foo[2] ); +ok( !Internals::SvREADONLY $foo[2], 0 ); +ok( !Internals::SvREADONLY $foo[2] ); + +ok( !Internals::SvREADONLY %foo ); +ok( Internals::SvREADONLY %foo, 1 ); +ok( Internals::SvREADONLY %foo ); +ok( !Internals::SvREADONLY %foo, 0 ); +ok( !Internals::SvREADONLY %foo ); + +ok( !Internals::SvREADONLY $foo{foo} ); +ok( Internals::SvREADONLY $foo{foo}, 1 ); +ok( Internals::SvREADONLY $foo{foo} ); +ok( !Internals::SvREADONLY $foo{foo}, 0 ); +ok( !Internals::SvREADONLY $foo{foo} ); + +is( Internals::SvREFCNT($foo), 1 ); +{ + my $bar = \$foo; + is( Internals::SvREFCNT($foo), 2 ); + is( Internals::SvREFCNT($bar), 1 ); +} +is( Internals::SvREFCNT($foo), 1 ); + |