diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2002-03-12 15:41:23 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-03-12 15:41:23 +0000 |
commit | 2956957731badfc3e16c029c1f22e4098fb8c46a (patch) | |
tree | 09c3c57a65da3e7734bd1174dbab4c81f38ef203 /lib/Internals.t | |
parent | 7530c94cc4e2a136116a8545073135072061ee62 (diff) | |
download | perl-2956957731badfc3e16c029c1f22e4098fb8c46a.tar.gz |
Move the readonly interface back to universal.c,
(new name: Internals::SvREADONLY), remove Data::Util,
move Hash::Util to lib, also introduce refcnt interface
(Internals::SvREFCNT). Make both the new interfaces
to be more sane so that if they set the value, they return
the new value, not the old one.
p4raw-id: //depot/perl@15201
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 ); + |