Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit b229fcf

Browse files
author
Reini Urban
committed
B::Deparse updated to 1.37_01c
i.e. from 5.24.0c without SIGNATURE and fake_signature Support for more cperl-specific ops: C<aelem*_u>, C<u_{add,subtract,multiply}>, C<{i,n,s}_aelem{,_u}>
1 parent 4770653 commit b229fcf

File tree

7 files changed

+327
-86
lines changed

7 files changed

+327
-86
lines changed

dist/Module-CoreList/lib/Module/CoreList.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12628,7 +12628,8 @@ for my $version ( sort { version_sort($a, $b) } keys %released ) {
1262812628
changed => {
1262912629
'Cpanel::JSON::XS' => '3.0217',
1263012630
'Config::Perl::V' => '0.26_01',
12631-
'B::C' => '1.54_07',
12631+
'B::C' => '1.54_08',
12632+
'B::Deparse' => '1.37_01c',
1263212633
'Data::Dumper' => '2.162',
1263312634
'Devel::PPPort' => '3.33_02',
1263412635
'DynaLoader' => '2.04c',

lib/B/Deparse-core.t

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Initially this test file just checked that CORE::foo got correctly
66
# deparsed as CORE::foo, hence the name. It's since been expanded
7-
# to fully test both CORE:: verses none, plus that any arguments
7+
# to fully test both CORE:: versus none, plus that any arguments
88
# are correctly deparsed. It also cross-checks against regen/keywords.pl
99
# to make sure we've tested all keywords, and with the correct strength.
1010
#
@@ -36,11 +36,10 @@ BEGIN {
3636

3737
use strict;
3838
use Test::More;
39-
plan tests => 4006;
39+
plan tests => 3886;
4040

4141
use feature (sprintf(":%vd", $^V)); # to avoid relying on the feature
4242
# logic to add CORE::
43-
no warnings 'experimental::autoderef';
4443
use B::Deparse;
4544
my $deparse = new B::Deparse;
4645

@@ -81,35 +80,35 @@ sub testit {
8180
$desc .= " (lex sub)" if $lexsub;
8281

8382

84-
my $code_ref;
83+
my ($code, $code_ref);
8584
if ($lexsub) {
8685
package lexsubtest;
8786
no warnings 'experimental::lexical_subs';
8887
use feature 'lexical_subs';
8988
no strict 'vars';
90-
$code_ref =
91-
eval "sub { state sub $keyword; ${vars}() = $expr }"
92-
|| die "$@ in $expr";
89+
$code = "sub { state sub $keyword; ${vars}() = $expr }";
90+
$code_ref = eval $code || die "$@ in $expr";
9391
}
9492
else {
9593
package test;
9694
use subs ();
9795
import subs $keyword;
98-
$code_ref = eval "no strict 'vars'; sub { ${vars}() = $expr }"
99-
or die "$@ in $expr";
96+
$code = "no strict 'vars'; sub { ${vars}() = $expr }";
97+
$code_ref = eval $code || die "$@ in $expr";
10098
}
10199

102100
my $got_text = $deparse->coderef2text($code_ref);
103101

104102
unless ($got_text =~ /
105103
package (?:lexsub)?test;
106-
BEGIN \{\$\{\^WARNING_BITS} = "[^"]*"}
107104
use strict 'refs', 'subs';
108105
use feature [^\n]+
109106
\Q$vars\E\(\) = (.*)
110107
}/s) {
111108
::fail($desc);
112109
::diag("couldn't extract line from boilerplate\n");
110+
::diag($code);
111+
::diag("=>");
113112
::diag($got_text);
114113
return;
115114
}
@@ -252,6 +251,7 @@ testit do => 'do { 1 };',
252251
"do {\n 1\n };";
253252

254253
testit each => 'CORE::each %bar;';
254+
testit each => 'CORE::each @foo;';
255255

256256
testit eof => 'CORE::eof();';
257257

@@ -271,17 +271,32 @@ testit glob => 'CORE::glob $a;', 'CORE::glob($a);';
271271
testit grep => 'CORE::grep { $a } $b, $c', 'grep({$a;} $b, $c);';
272272

273273
testit keys => 'CORE::keys %bar;';
274+
testit keys => 'CORE::keys @bar;';
274275

275276
testit map => 'CORE::map { $a } $b, $c', 'map({$a;} $b, $c);';
276277

277278
testit not => '3 unless CORE::not $a && $b;';
278279

280+
testit pop => 'CORE::pop @foo;';
281+
282+
testit push => 'CORE::push @foo;', 'CORE::push(@foo);';
283+
testit push => 'CORE::push @foo, 1;', 'CORE::push(@foo, 1);';
284+
testit push => 'CORE::push @foo, 1, 2;', 'CORE::push(@foo, 1, 2);';
285+
279286
testit readline => 'CORE::readline $a . $b;';
280287

281288
testit readpipe => 'CORE::readpipe $a + $b;';
282289

283290
testit reverse => 'CORE::reverse sort(@foo);';
284291

292+
testit shift => 'CORE::shift @foo;';
293+
294+
testit splice => q{CORE::splice @foo;}, q{CORE::splice(@foo);};
295+
testit splice => q{CORE::splice @foo, 0;}, q{CORE::splice(@foo, 0);};
296+
testit splice => q{CORE::splice @foo, 0, 1;}, q{CORE::splice(@foo, 0, 1);};
297+
testit splice => q{CORE::splice @foo, 0, 1, 'a';}, q{CORE::splice(@foo, 0, 1, 'a');};
298+
testit splice => q{CORE::splice @foo, 0, 1, 'a', 'b';}, q{CORE::splice(@foo, 0, 1, 'a', 'b');};
299+
285300
# note that the test does '() = split...' which is why the
286301
# limit is optimised to 1
287302
testit split => 'split;', q{split(' ', $_, 1);};
@@ -298,7 +313,12 @@ testit sub => 'CORE::sub { $a, $b }',
298313

299314
testit system => 'CORE::system($foo $bar);';
300315

316+
testit unshift => 'CORE::unshift @foo;', 'CORE::unshift(@foo);';
317+
testit unshift => 'CORE::unshift @foo, 1;', 'CORE::unshift(@foo, 1);';
318+
testit unshift => 'CORE::unshift @foo, 1, 2;', 'CORE::unshift(@foo, 1, 2);';
319+
301320
testit values => 'CORE::values %bar;';
321+
testit values => 'CORE::values @foo;';
302322

303323

304324
# XXX These are deparsed wrapped in parens.
@@ -463,7 +483,7 @@ defined 01 $+
463483
die @ p1
464484
# do handled specially
465485
# dump handled specially
466-
each 1 - # also tested specially
486+
# each handled specially
467487
endgrent 0 -
468488
endhostent 0 -
469489
endnetent 0 -
@@ -522,7 +542,7 @@ index 23 p
522542
int 01 $
523543
ioctl 3 p
524544
join 13 p
525-
keys 1 - # also tested specially
545+
# keys handled specially
526546
kill 123 p
527547
# last handled specially
528548
lc 01 $
@@ -555,12 +575,12 @@ ord 01 $
555575
our 123 p+ # skip with 0 args, as our() => ()
556576
pack 123 p
557577
pipe 2 p
558-
pop 01 1
578+
pop 0 1 # also tested specially
559579
pos 01 $+
560580
print @ p$+
561581
printf @ p$+
562582
prototype 1 +
563-
push 123 p
583+
# push handled specially
564584
quotemeta 01 $
565585
rand 01 -
566586
read 34 p
@@ -601,7 +621,7 @@ setprotoent 1 -
601621
setpwent 0 -
602622
setservent 1 -
603623
setsockopt 4 p
604-
shift 01 1
624+
shift 0 1 # also tested specially
605625
shmctl 3 p
606626
shmget 3 p
607627
shmread 4 p
@@ -613,7 +633,7 @@ socket 4 p
613633
socketpair 5 p
614634
sort @ p1+
615635
# split handled specially
616-
splice 12345 p
636+
# splice handled specially
617637
sprintf 123 p
618638
sqrt 01 $
619639
srand 01 -
@@ -642,10 +662,10 @@ umask 01 -
642662
undef 01 +
643663
unlink @ p$
644664
unpack 12 p$
645-
unshift 1 p
665+
# unshift handled specially
646666
untie 1 -
647667
utime @ p1
648-
values 1 - # also tested specially
668+
# values handled specially
649669
vec 3 p
650670
wait 0 -
651671
waitpid 2 p

0 commit comments

Comments
 (0)