Skip to content

Commit 685045d

Browse files
committed
fix export bug with legacy mode (fixes #47)
1 parent 7d41073 commit 685045d

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Revision history for Perl extension {{$dist->name}}
22

33
{{$NEXT}}
4+
- Fix bug introduced in 1.30 where exports were not happening correctly
5+
in legacy mode (gh#47)
46

57
1.30 2025-08-04 14:01:25 -0600
68
- Documentation improvements (#42)

lib/Test/Script.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ sub import {
102102
$ctx->hub->plan('NO PLAN');
103103
}
104104
$ctx->release;
105+
foreach ( @EXPORT ) {
106+
$class->export_to_level(1, $class, $_);
107+
}
105108
}
106109
else
107110
{

t/test_script__exports__gh47.t

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
use Test2::V0 -no_srand => 1;
2+
use Test::Script tests => 1;
3+
4+
# replaces t/01_compile.t
5+
6+
subtest 'expected imports' => sub {
7+
imported_ok $_ for qw(
8+
script_compiles
9+
script_compiles_ok
10+
script_runs
11+
script_stdout_is
12+
script_stdout_isnt
13+
script_stdout_like
14+
script_stdout_unlike
15+
script_stderr_is
16+
script_stderr_isnt
17+
script_stderr_like
18+
script_stderr_unlike
19+
program_runs
20+
program_stdout_is
21+
program_stdout_isnt
22+
program_stdout_like
23+
program_stdout_unlike
24+
program_stderr_is
25+
program_stderr_isnt
26+
program_stderr_like
27+
program_stderr_unlike
28+
);
29+
};
30+
31+
done_testing;

0 commit comments

Comments
 (0)