X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcompiling-package.t;fp=t%2Fcompiling-package.t;h=5c3764f7f9a037a696658c88cfbd9df1b5bbcec7;hb=a0e934a667e05d3a8b5556e257938472cd9d6243;hp=0000000000000000000000000000000000000000;hpb=7fdc514fb2d9768b3d38d078cf24d9d03403539b;p=gitmo%2FEval-Closure.git diff --git a/t/compiling-package.t b/t/compiling-package.t new file mode 100644 index 0000000..5c3764f --- /dev/null +++ b/t/compiling-package.t @@ -0,0 +1,17 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +use Eval::Closure; + +my $code = eval_closure( + source => 'no strict "refs"; sub { keys %{__PACKAGE__ . "::"} }', +); + +# defining the sub { } creates __ANON__, calling 'no strict' creates BEGIN +my @stash_keys = grep { $_ ne '__ANON__' && $_ ne 'BEGIN' } $code->(); + +is_deeply([@stash_keys], [], "compiled in an empty package"); + +done_testing;