diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2022-01-21 18:37:26 +0000 |
---|---|---|
committer | Paul Evans <leonerd@leonerd.org.uk> | 2022-01-25 15:02:58 +0000 |
commit | e678439a46103f617e2830ec64d7e7e88075a169 (patch) | |
tree | 7b452e43a5d5de468d9c9e8310da17c3f2983ebc /t | |
parent | cc4aa2131ff2d87e0c3fa9bd8cf3bcfa66e245f3 (diff) | |
download | perl-e678439a46103f617e2830ec64d7e7e88075a169.tar.gz |
Fix unit tests for experimental::builtin warnings
Diffstat (limited to 't')
-rw-r--r-- | t/op/array.t | 1 | ||||
-rw-r--r-- | t/op/hash.t | 1 | ||||
-rw-r--r-- | t/op/hashassign.t | 1 | ||||
-rw-r--r-- | t/op/lvref.t | 1 | ||||
-rw-r--r-- | t/op/ref.t | 5 | ||||
-rw-r--r-- | t/op/svleak.t | 1 | ||||
-rw-r--r-- | t/op/threads.t | 5 | ||||
-rw-r--r-- | t/op/tie.t | 2 | ||||
-rw-r--r-- | t/op/write.t | 1 | ||||
-rw-r--r-- | t/perf/opcount.t | 1 | ||||
-rw-r--r-- | t/porting/podcheck.t | 1 | ||||
-rw-r--r-- | t/re/qr-72922.t | 1 |
12 files changed, 21 insertions, 0 deletions
diff --git a/t/op/array.t b/t/op/array.t index af68856655..188bedfecd 100644 --- a/t/op/array.t +++ b/t/op/array.t @@ -441,6 +441,7 @@ pass 'no crash when freeing array that is being cleared'; # [perl #85670] Copying magic to elements package glelp { + no warnings 'experimental::builtin'; use builtin 'weaken'; weaken ($a = \@ISA); @ISA = qw(Foo); diff --git a/t/op/hash.t b/t/op/hash.t index 1d140be666..0ad4890824 100644 --- a/t/op/hash.t +++ b/t/op/hash.t @@ -102,6 +102,7 @@ sub guard::DESTROY { # Weak references to pad hashes { my $ref; + no warnings 'experimental::builtin'; use builtin 'weaken'; { my %hash; diff --git a/t/op/hashassign.t b/t/op/hashassign.t index d8bd9609e5..d20c3c92c7 100644 --- a/t/op/hashassign.t +++ b/t/op/hashassign.t @@ -312,6 +312,7 @@ foreach my $chr (60, 200, 600, 6000, 60000) { # [perl #76716] Hash assignment should not zap weak refs. { my %tb; + no warnings 'experimental::builtin'; use builtin 'weaken'; weaken(my $p = \%tb); %tb = (); diff --git a/t/op/lvref.t b/t/op/lvref.t index 9553583848..f96d949b0f 100644 --- a/t/op/lvref.t +++ b/t/op/lvref.t @@ -540,6 +540,7 @@ like $@, { my $a; + no warnings 'experimental::builtin'; builtin::weaken($r = \$a); \$a = $r; pass 'no crash when assigning \$lex = $weakref_to_lex' diff --git a/t/op/ref.t b/t/op/ref.t index fbe0d1ffd2..77b5193a16 100644 --- a/t/op/ref.t +++ b/t/op/ref.t @@ -731,6 +731,7 @@ is (runperl( # for the different way backref magic is stored fresh_perl_is(<<'EOF', 'ok', { stderr => 1 }, 'array with 1 weak ref'); +no warnings 'experimental::builtin'; use builtin qw(weaken); my $r = []; Internals::SvREFCNT(@$r, 9); @@ -740,6 +741,7 @@ print "ok"; EOF fresh_perl_is(<<'EOF', 'ok', { stderr => 1 }, 'array with 2 weak refs'); +no warnings 'experimental::builtin'; use builtin qw(weaken); my $r = []; Internals::SvREFCNT(@$r, 9); @@ -751,6 +753,7 @@ print "ok"; EOF fresh_perl_is(<<'EOF', 'ok', { stderr => 1 }, 'hash with 1 weak ref'); +no warnings 'experimental::builtin'; use builtin qw(weaken); my $r = {}; Internals::SvREFCNT(%$r, 9); @@ -760,6 +763,7 @@ print "ok"; EOF fresh_perl_is(<<'EOF', 'ok', { stderr => 1 }, 'hash with 2 weak refs'); +no warnings 'experimental::builtin'; use builtin qw(weaken); my $r = {}; Internals::SvREFCNT(%$r, 9); @@ -775,6 +779,7 @@ EOF { my $error; *hassgropper::DESTROY = sub { + no warnings 'experimental::builtin'; use builtin qw(weaken); eval { weaken($_[0]) }; $error = $@; diff --git a/t/op/svleak.t b/t/op/svleak.t index 523293c74e..a5c717ca09 100644 --- a/t/op/svleak.t +++ b/t/op/svleak.t @@ -225,6 +225,7 @@ leak_expr(5, 0, q{"YYYYYa" =~ /.+?(a(.+?)|b)/ }, "trie leak"); { # broken by 304474c3, fixed by cefd5c7c, but didn't seem to cause # any other test failures # base test case from ribasushi (Peter Rabbitson) + no warnings 'experimental::builtin'; use builtin 'weaken'; my $weak; { diff --git a/t/op/threads.t b/t/op/threads.t index 1277169f4c..35ddad1872 100644 --- a/t/op/threads.t +++ b/t/op/threads.t @@ -29,6 +29,7 @@ EOI # Attempt to free unreferenced scalar: SV 0x814e0dc. fresh_perl_is(<<'EOI', 'ok', { }, 'weaken ref under threads'); use threads; +no warnings 'experimental::builtin'; use builtin 'weaken'; my $data = "a"; my $obj = \$data; @@ -47,6 +48,7 @@ package Foo; sub new { bless {},shift } package main; use threads; +no warnings 'experimental::builtin'; use builtin 'weaken'; my $object = Foo->new; my $ref = $object; @@ -217,6 +219,7 @@ EOJ # The weak reference $a, however, is visible from the symbol table. fresh_perl_is(<<'EOI', 'ok', { }, 'Test for 34394ecd06e704e9'); use threads; + no warnings 'experimental::builtin'; use builtin 'weaken'; %h = (1, 2); $a = \$h{1}; @@ -243,6 +246,7 @@ EOI fresh_perl_is(<<'EOI', 'ok', { }, '0 refcnt neither on tmps stack nor in @_'); use threads; + no warnings 'experimental::builtin'; use builtin 'weaken'; my %h = (1, []); my $a = $h{1}; @@ -295,6 +299,7 @@ use threads; { package My::Obj; + no warnings 'experimental::builtin'; use builtin 'weaken'; my %reg; diff --git a/t/op/tie.t b/t/op/tie.t index e09b080559..9cc1599331 100644 --- a/t/op/tie.t +++ b/t/op/tie.t @@ -996,6 +996,7 @@ EXPECT # # [perl #86328] Crash when freeing tie magic that can increment the refcnt +no warnings 'experimental::builtin'; use builtin 'weaken'; sub TIEHASH { @@ -1189,6 +1190,7 @@ EXPECT BEGIN { unless (defined &DynaLoader::boot_DynaLoader) { print "HASH\nHASH\nARRAY\nARRAY\n"; exit; }} +no warnings 'experimental::builtin'; use builtin 'weaken'; { package xoufghd; sub TIEHASH { weaken($_[1]); bless \$_[1], xoufghd:: } diff --git a/t/op/write.t b/t/op/write.t index feb1ffc9a8..46660506f5 100644 --- a/t/op/write.t +++ b/t/op/write.t @@ -1973,6 +1973,7 @@ close STRICT or die "Could not close: $!"; is cat('Op_write.tmp'), "oof:\n", 'pragmata on format line'; { + no warnings 'experimental::builtin'; use builtin 'weaken'; sub Potshriggley { format Potshriggley = diff --git a/t/perf/opcount.t b/t/perf/opcount.t index 3351f50f07..4e0d9736cf 100644 --- a/t/perf/opcount.t +++ b/t/perf/opcount.t @@ -699,6 +699,7 @@ test_opcount(0, "multiconcat: local assign", } # builtin:: function calls should be replaced with efficient op implementations +no warnings 'experimental::builtin'; test_opcount(0, "builtin::true/false are replaced with constants", sub { my $x = builtin::true(); my $y = builtin::false() }, diff --git a/t/porting/podcheck.t b/t/porting/podcheck.t index a03bfee7f3..0f2f4735ac 100644 --- a/t/porting/podcheck.t +++ b/t/porting/podcheck.t @@ -11,6 +11,7 @@ BEGIN { use strict; use warnings; use feature 'unicode_strings'; +no warnings 'experimental::builtin'; use builtin 'refaddr'; use Carp; diff --git a/t/re/qr-72922.t b/t/re/qr-72922.t index 279aba8146..857d88e907 100644 --- a/t/re/qr-72922.t +++ b/t/re/qr-72922.t @@ -6,6 +6,7 @@ BEGIN { require './test.pl'; } +no warnings 'experimental::builtin'; use builtin 'weaken'; plan(tests => 14); |