X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fundef.t;h=f6e36a5bed43c8163e60ab349ef61d508fe7fec8;hb=a4c04bdcc508b6a45f83e703d0f82401445aa55b;hp=8ab2ec421f32c0c38bede2419af908ccfffdca03;hpb=79072805bf63abe5b5978b5928ab00d360ea3e7f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/undef.t b/t/op/undef.t index 8ab2ec4..f6e36a5 100755 --- a/t/op/undef.t +++ b/t/op/undef.t @@ -1,8 +1,11 @@ #!./perl -# $RCSfile: undef.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:34 $ +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} -print "1..21\n"; +print "1..27\n"; print defined($a) ? "not ok 1\n" : "ok 1\n"; @@ -54,3 +57,25 @@ sub foo { print "ok 19\n"; } print defined &foo ? "ok 20\n" : "not ok 20\n"; undef &foo; print defined(&foo) ? "not ok 21\n" : "ok 21\n"; + +eval { undef $1 }; +print $@ =~ /^Modification of a read/ ? "ok 22\n" : "not ok 22\n"; + +eval { $1 = undef }; +print $@ =~ /^Modification of a read/ ? "ok 23\n" : "not ok 23\n"; + +{ + require Tie::Hash; + tie my %foo, 'Tie::StdHash'; + print defined %foo ? "ok 24\n" : "not ok 24\n"; + %foo = ( a => 1 ); + print defined %foo ? "ok 25\n" : "not ok 25\n"; +} + +{ + require Tie::Array; + tie my @foo, 'Tie::StdArray'; + print defined @foo ? "ok 26\n" : "not ok 26\n"; + @foo = ( a => 1 ); + print defined @foo ? "ok 27\n" : "not ok 27\n"; +}