X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fhashwarn.t;h=50c993939fae56952c542ad449bb35bad85516f0;hb=3444c34c7da9f235e181b5c175a1fa1357e7a055;hp=9182273ec3c673a82c9ec2b369a35fd946813d55;hpb=ee8c7f5465f003860e2347a2946abacac39bd9b9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/hashwarn.t b/t/op/hashwarn.t index 9182273..50c9939 100755 --- a/t/op/hashwarn.t +++ b/t/op/hashwarn.t @@ -2,7 +2,7 @@ BEGIN { chdir 't' if -d 't'; - unshift @INC, '../lib'; + @INC = '../lib'; } use strict; @@ -45,7 +45,8 @@ sub test_warning ($$$) { # print "# $num: $got\n"; } -my $odd_msg = '/^Odd number of elements in hash/'; +my $odd_msg = '/^Odd number of elements in hash assignment/'; +my $odd_msg2 = '/^Odd number of elements in anonymous hash/'; my $ref_msg = '/^Reference found where even-sized list expected/'; { @@ -56,7 +57,7 @@ my $ref_msg = '/^Reference found where even-sized list expected/'; test_warning 2, shift @warnings, $odd_msg; %hash = { 1..3 }; - test_warning 3, shift @warnings, $odd_msg; + test_warning 3, shift @warnings, $odd_msg2; test_warning 4, shift @warnings, $ref_msg; %hash = [ 1..3 ]; @@ -65,12 +66,18 @@ my $ref_msg = '/^Reference found where even-sized list expected/'; %hash = sub { print "ok" }; test_warning 6, shift @warnings, $odd_msg; + # Old pseudo-hash syntax, now removed. my $avhv = [{x=>1,y=>2}]; - %$avhv = (x=>13,'y'); - test_warning 7, shift @warnings, $odd_msg; - - %$avhv = 'x'; - test_warning 8, shift @warnings, $odd_msg; + eval { + %$avhv = (x=>13,'y'); + }; + test 7, $@ =~ /^Not a HASH reference/; + + # Old pseudo-hash syntax, since removed. + eval { + %$avhv = 'x'; + }; + test 8, $@ =~ /^Not a HASH reference/; $_ = { 1..10 }; test 9, ! @warnings, "Unexpected warning";