Skip to content

Commit a0c7035

Browse files
committed
Add test for precompilation
1 parent caf7b40 commit a0c7035

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

t/Precomp/First.pm6

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
use lib 'lib', 'blib/lib';
2+
use Inline::Python;
3+
4+
class Precomp::First { }

t/Precomp/Second.pm6

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
use lib 't';
2+
use Precomp::First;
3+
4+
class Precomp::Second { }

t/precomp.t

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env perl6
2+
3+
use v6;
4+
use Test;
5+
use Inline::Python;
6+
7+
BEGIN {
8+
%*ENV<PERL6LIB> = 'lib:blib/lib';
9+
}
10+
11+
plan 2;
12+
13+
my $ipc = CompUnit.new('lib/Inline/Python.pm6');
14+
my $already-precompiled = $ipc.precomp-path.IO.e;
15+
16+
if not $already-precompiled {
17+
$ipc.precomp;
18+
}
19+
20+
my $first = CompUnit.new('t/Precomp/First.pm6');
21+
my $second = CompUnit.new('t/Precomp/Second.pm6');
22+
23+
ok $first.precomp;
24+
ok $second.precomp;
25+
26+
# clean up
27+
sub rmpp($cu) {
28+
unlink($cu.precomp-path);
29+
}
30+
31+
rmpp($first);
32+
rmpp($second);
33+
34+
if not $already-precompiled {
35+
rmpp($ipc);
36+
}
37+
38+
# vim: ft=perl6

0 commit comments

Comments
 (0)