@@ -18,7 +18,7 @@ BEGIN {
18
18
# If you find tests are failing, please try adding names to tests to track
19
19
# down where the failure is, and supply your new names as a patch.
20
20
# (Just-in-time test naming)
21
- plan tests => 491 ;
21
+ plan tests => 504 ;
22
22
23
23
# numerics
24
24
ok ((0xdead & 0xbeef) == 0x9ead);
@@ -612,9 +612,74 @@ foreach my $op_info ([and => "&"], [or => "|"], [xor => "^"]) {
612
612
"(~) is not allowed";
613
613
}
614
614
615
- is("abc" & "abc\x{100} ", "abc", '"abc" & "abc\x{100} " works');
616
- is("abc" | "abc\x{100} ", "abc\x{100} ", '"abc" | "abc\x{100} " works');
617
- is("abc" ^ "abc\x{100} ", "\0\0\0\x{100} ", '"abc" ^ "abc\x{100} " works');
618
- is("abc\x{100} " & "abc", "abc", '"abc\x{100} " & "abc" works');
619
- is("abc\x{100} " | "abc", "abc\x{100} ", '"abc\x{100} " | "abc" works');
620
- is("abc\x{100} " ^ "abc", "\0\0\0\x{100} ", '"abc\x{100} " ^ "abc" works');
615
+ {
616
+ # Since these are temporary, and it was a pain to make them into loops,
617
+ # the code is just rolled out.
618
+ local $SIG {__WARN__} = sub { push @warnings , @_ ; };
619
+
620
+ undef @warnings ;
621
+ is("abc" & "abc\x{100} ", "abc", '"abc" & "abc\x{100} " works');
622
+ if (! is(@warnings , 1, "... but returned a single warning")) {
623
+ diag join "\n ", @warnings ;
624
+ }
625
+ like ($warnings [0], qr /^Use of strings with code points over 0xFF as (?#
626
+ )arguments to bitwise and \( &\) operator (?#
627
+ )is deprecated/,
628
+ "... which is the expected warning");
629
+ undef @warnings ;
630
+ is("abc" | "abc\x{100} ", "abc\x{100} ", '"abc" | "abc\x{100} " works');
631
+ if (! is(@warnings , 1, "... but returned a single warning")) {
632
+ diag join "\n ", @warnings ;
633
+ }
634
+ like ($warnings [0], qr /^Use of strings with code points over 0xFF as (?#
635
+ )arguments to bitwise or \( |\) operator (?#
636
+ )is deprecated/,
637
+ "... which is the expected warning");
638
+ undef @warnings ;
639
+ is("abc" ^ "abc\x{100} ", "\0\0\0\x{100} ", '"abc" ^ "abc\x{100} " works');
640
+ if (! is(@warnings , 1, "... but returned a single warning")) {
641
+ diag join "\n ", @warnings ;
642
+ }
643
+ like ($warnings [0], qr /^Use of strings with code points over 0xFF as (?#
644
+ )arguments to bitwise xor \(\^\) operator (?#
645
+ )is deprecated/,
646
+ "... which is the expected warning");
647
+ undef @warnings ;
648
+ is("abc\x{100} " & "abc", "abc", '"abc\x{100} " & "abc" works');
649
+ if (! is(@warnings , 1, "... but returned a single warning")) {
650
+ diag join "\n ", @warnings ;
651
+ }
652
+ like ($warnings [0], qr /^Use of strings with code points over 0xFF as (?#
653
+ )arguments to bitwise and \( &\) operator (?#
654
+ )is deprecated/,
655
+ "... which is the expected warning");
656
+ undef @warnings ;
657
+ is("abc\x{100} " | "abc", "abc\x{100} ", '"abc\x{100} " | "abc" works');
658
+ if (! is(@warnings , 1, "... but returned a single warning")) {
659
+ diag join "\n ", @warnings ;
660
+ }
661
+ like ($warnings [0], qr /^Use of strings with code points over 0xFF as (?#
662
+ )arguments to bitwise or \( |\) operator (?#
663
+ )is deprecated/,
664
+ "... which is the expected warning");
665
+ undef @warnings ;
666
+ is("abc\x{100} " ^ "abc", "\0\0\0\x{100} ", '"abc\x{100} " ^ "abc" works');
667
+ if (! is(@warnings , 1, "... but returned a single warning")) {
668
+ diag join "\n ", @warnings ;
669
+ }
670
+ like ($warnings [0], qr /^Use of strings with code points over 0xFF as (?#
671
+ )arguments to bitwise xor \(\^\) operator (?#
672
+ )is deprecated/,
673
+ "... which is the expected warning");
674
+ no warnings 'deprecated';
675
+ undef @warnings ;
676
+ my $foo = "abc" & "abc\x{100} ";
677
+ $foo = "abc" | "abc\x{100} ";
678
+ $foo = "abc" ^ "abc\x{100} ";
679
+ $foo = "abc\x{100} " & "abc";
680
+ $foo = "abc\x{100} " | "abc";
681
+ $foo = "abc\x{100} " ^ "abc";
682
+ if (! is(@warnings , 0, "... And none of the last 6 main tests warns when 'deprecated' is off")) {
683
+ diag join "\n ", @warnings ;
684
+ }
685
+ }
0 commit comments