diff --git a/Changes b/Changes index 4dcc680..d384ad8 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for Perl extension {{$dist->name}} {{$NEXT}} + - Fix bug introduced in 1.30 where exports were not happening correctly + in legacy mode (gh#47) 1.30 2025-08-04 14:01:25 -0600 - Documentation improvements (#42) diff --git a/lib/Test/Script.pm b/lib/Test/Script.pm index e17f4ce..7dc7eb1 100644 --- a/lib/Test/Script.pm +++ b/lib/Test/Script.pm @@ -102,6 +102,9 @@ sub import { $ctx->hub->plan('NO PLAN'); } $ctx->release; + foreach ( @EXPORT ) { + $class->export_to_level(1, $class, $_); + } } else { diff --git a/t/test_script__exports__gh47.t b/t/test_script__exports__gh47.t new file mode 100644 index 0000000..b23aa7d --- /dev/null +++ b/t/test_script__exports__gh47.t @@ -0,0 +1,31 @@ +use Test2::V0 -no_srand => 1; +use Test::Script tests => 1; + +# replaces t/01_compile.t + +subtest 'expected imports' => sub { + imported_ok $_ for qw( + script_compiles + script_compiles_ok + script_runs + script_stdout_is + script_stdout_isnt + script_stdout_like + script_stdout_unlike + script_stderr_is + script_stderr_isnt + script_stderr_like + script_stderr_unlike + program_runs + program_stdout_is + program_stdout_isnt + program_stdout_like + program_stdout_unlike + program_stderr_is + program_stderr_isnt + program_stderr_like + program_stderr_unlike + ); +}; + +done_testing;