Skip to content

Commit

Permalink
Add unit test t/op/stash_parse_gv.t
Browse files Browse the repository at this point in the history
This test add coverage for long function names
in order to increase test coverage for
S_parse_gv_stash_name function.
  • Loading branch information
atoomic authored and tonycoz committed Sep 4, 2017
1 parent 8c573be commit f3d6edb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -5699,6 +5699,7 @@ t/op/sprintf2.t See if sprintf works
t/op/srand.t See if srand works
t/op/sselect.t See if 4 argument select works
t/op/stash.t See if %:: stashes work
t/op/stash_parse_gv.t See if parse_gv_stash_name works
t/op/stat.t See if stat works
t/op/state.t See if state variables work
t/op/study.t See if study works
Expand Down
31 changes: 31 additions & 0 deletions t/op/stash_parse_gv.t
@@ -0,0 +1,31 @@
#!./perl

BEGIN {
chdir 't' if -d 't';
require "./test.pl";
set_up_inc(qw(../lib));
}

plan( tests => 5 );

my $long = 'x' x 100;
my $short = 'abcd';

my @tests = (
[ $long, 'long package name: one word' ],
[ join( '::', $long, $long ), 'long package name: multiple words' ],
[ join( q['], $long, $long ), q[long package name: multiple words using "'" separator] ],
[ join( '::', $long, $short, $long ), 'long & short package name: multiple words' ],
[ join( q['], $long, $short, $long ), q[long & short package name: multiple words using "'" separator] ],
);

foreach my $t (@tests) {
my ( $sub, $name ) = @$t;

fresh_perl_is(
qq[sub $sub { print qq[ok\n]} &{"$sub"} ],
q[ok],
{ switches => ['-w'] },
$name
);
}

0 comments on commit f3d6edb

Please sign in to comment.