Re: the remaining bugs in \x escapes (was Re: [PATCH] oct and hex in glorious 64...
[p5sagit/p5-mst-13.2.git] / t / op / undef.t
old mode 100644 (file)
new mode 100755 (executable)
index fc73cf8..f6e36a5
@@ -1,8 +1,11 @@
 #!./perl
 
-# $Header: undef.t,v 4.0 91/03/20 01:55:16 lwall Locked $
+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";
+}