Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add test for precompilation
  • Loading branch information
niner committed Oct 14, 2014
1 parent caf7b40 commit a0c7035
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions t/Precomp/First.pm6
@@ -0,0 +1,4 @@
use lib 'lib', 'blib/lib';
use Inline::Python;

class Precomp::First { }
4 changes: 4 additions & 0 deletions t/Precomp/Second.pm6
@@ -0,0 +1,4 @@
use lib 't';
use Precomp::First;

class Precomp::Second { }
38 changes: 38 additions & 0 deletions t/precomp.t
@@ -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

0 comments on commit a0c7035

Please sign in to comment.