Skip to content

Commit f3d6edb

Browse files
atoomictonycoz
authored andcommitted
Add unit test t/op/stash_parse_gv.t
This test add coverage for long function names in order to increase test coverage for S_parse_gv_stash_name function.
1 parent 8c573be commit f3d6edb

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

MANIFEST

+1
Original file line numberDiff line numberDiff line change
@@ -5699,6 +5699,7 @@ t/op/sprintf2.t See if sprintf works
56995699
t/op/srand.t See if srand works
57005700
t/op/sselect.t See if 4 argument select works
57015701
t/op/stash.t See if %:: stashes work
5702+
t/op/stash_parse_gv.t See if parse_gv_stash_name works
57025703
t/op/stat.t See if stat works
57035704
t/op/state.t See if state variables work
57045705
t/op/study.t See if study works

t/op/stash_parse_gv.t

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!./perl
2+
3+
BEGIN {
4+
chdir 't' if -d 't';
5+
require "./test.pl";
6+
set_up_inc(qw(../lib));
7+
}
8+
9+
plan( tests => 5 );
10+
11+
my $long = 'x' x 100;
12+
my $short = 'abcd';
13+
14+
my @tests = (
15+
[ $long, 'long package name: one word' ],
16+
[ join( '::', $long, $long ), 'long package name: multiple words' ],
17+
[ join( q['], $long, $long ), q[long package name: multiple words using "'" separator] ],
18+
[ join( '::', $long, $short, $long ), 'long & short package name: multiple words' ],
19+
[ join( q['], $long, $short, $long ), q[long & short package name: multiple words using "'" separator] ],
20+
);
21+
22+
foreach my $t (@tests) {
23+
my ( $sub, $name ) = @$t;
24+
25+
fresh_perl_is(
26+
qq[sub $sub { print qq[ok\n]} &{"$sub"} ],
27+
q[ok],
28+
{ switches => ['-w'] },
29+
$name
30+
);
31+
}

0 commit comments

Comments
 (0)