Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add test for precompilation
- Loading branch information
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| use lib 'lib', 'blib/lib'; | ||
| use Inline::Python; | ||
|
|
||
| class Precomp::First { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| use lib 't'; | ||
| use Precomp::First; | ||
|
|
||
| class Precomp::Second { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #!/usr/bin/env perl6 | ||
|
|
||
| use v6; | ||
| use Test; | ||
| use Inline::Python; | ||
|
|
||
| BEGIN { | ||
| %*ENV<PERL6LIB> = 'lib:blib/lib'; | ||
| } | ||
|
|
||
| plan 2; | ||
|
|
||
| my $ipc = CompUnit.new('lib/Inline/Python.pm6'); | ||
| my $already-precompiled = $ipc.precomp-path.IO.e; | ||
|
|
||
| if not $already-precompiled { | ||
| $ipc.precomp; | ||
| } | ||
|
|
||
| my $first = CompUnit.new('t/Precomp/First.pm6'); | ||
| my $second = CompUnit.new('t/Precomp/Second.pm6'); | ||
|
|
||
| ok $first.precomp; | ||
| ok $second.precomp; | ||
|
|
||
| # clean up | ||
| sub rmpp($cu) { | ||
| unlink($cu.precomp-path); | ||
| } | ||
|
|
||
| rmpp($first); | ||
| rmpp($second); | ||
|
|
||
| if not $already-precompiled { | ||
| rmpp($ipc); | ||
| } | ||
|
|
||
| # vim: ft=perl6 |