test in change#4428 needs strict interpretation of C modulus
[p5sagit/p5-mst-13.2.git] / t / op / avhv.t
index 272d222..92afa37 100755 (executable)
@@ -2,7 +2,7 @@
       
 BEGIN {
     chdir 't' if -d 't';
-    @INC = '../lib';
+    unshift @INC, '../lib';
 }
 
 require Tie::Array;
@@ -17,7 +17,7 @@ sub STORESIZE { $#{$_[0]} = $_[1]+1 }
 
 package main;
 
-print "1..10\n";
+print "1..15\n";
 
 $sch = {
     'abc' => 1,
@@ -96,3 +96,25 @@ print "ok 9\n";
 $avhv = [{foo=>1, bar=>2}];
 print "not " unless %$avhv =~ m,^\d+/\d+,;
 print "ok 10\n";
+
+# check if defelem magic works
+sub f {
+    print "not " unless $_[0] eq 'a';
+    $_[0] = 'b';
+    print "ok 11\n";
+}
+$a = [{key => 1}, 'a'];
+f($a->{key});
+print "not " unless $a->[1] eq 'b';
+print "ok 12\n";
+
+# check if exists() is behaving properly
+$avhv = [{foo=>1,bar=>2,pants=>3}];
+print "not " if exists $avhv->{bar};
+print "ok 13\n";
+
+$avhv->{pants} = undef;
+print "not " unless exists $avhv->{pants};
+print "ok 14\n";
+print "not " if exists $avhv->{bar};
+print "ok 15\n";