Skip to content

Commit

Permalink
Add test for loading module .pm files (#466)
Browse files Browse the repository at this point in the history
* add tests for =defn implementation

* add new file and new tests for loading .pm modules
  • Loading branch information
tbrowder committed Aug 30, 2018
1 parent 741d473 commit 5c7df0d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 8 additions & 1 deletion S10-packages/basic.t
Expand Up @@ -6,7 +6,7 @@ use lib $?FILE.IO.parent(2).add("packages");
use Test;
use Test::Util;

plan 83;
plan 85;

my regex fairly_conclusive_platform_error {:i ^\N* <<Null?>>}

Expand Down Expand Up @@ -200,6 +200,13 @@ eval-lives-ok q' module MapTester { (1, 2, 3).map: { $_ } } ',
is EVAL('use PM6; pm6_works()'), 42, 'can call subs exported from .pm6 module';
}

# the following was added during the roast name change from "*.pm" to
# "*.pm6" to ensure the ".pm" suffix is still valid for old code
{
eval-lives-ok 'use PM', 'can load a module ending in .pm';
is EVAL('use PM; pm_works()'), 42, 'can call subs exported from .pm module';
}

# package Foo; is perl 5 code;
# RT #75458
{
Expand Down
9 changes: 9 additions & 0 deletions packages/PM.pm
@@ -0,0 +1,9 @@
#============ DO NOT RENAME THIS FILE SUFFIX TO "PM.pm6" =============
#
# THIS FILE EXISTS TO TEST PROPER LOADING OF MODULES WITH A ".pm" FILE
# EXTENSION.
#
#=====================================================================
module PM {
sub pm_works() is export { 42 }
}

0 comments on commit 5c7df0d

Please sign in to comment.