File: 86-xs-par.t

package info (click to toggle)
libpar-packer-perl 1.064-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,388 kB
  • sloc: perl: 12,774; ansic: 1,474; makefile: 30; sh: 5
file content (37 lines) | stat: -rw-r--r-- 1,007 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl

use strict;
use warnings;

use Test::More;
require "./t/utils.pl";

plan tests => 3;

# use an absolute pathname in case a test chdir()s
my $pp = catfile(getcwd(), qw( blib script pp ));
$pp = '/usr/bin/pp' if $ENV{AUTOPKGTEST_TMP};

# runs 1 test
sub pp_p_ok
{
    $ENV{PAR_TMPDIR} ||= tempdir(TMPDIR => 1, CLEANUP => 1);
    my $par = catfile($ENV{PAR_TMPDIR},"my.par");
    unlink($par);

    die "system(LIST) with double quotes in LIST doesn't work on Windows: @_"
        if grep { /"/ } @_;
    # Note: The test harness runs tests 
    # with PERL5LIB prepended as if "-Mblib" was in effect
    system($^X, $pp, -p => -o => $par, @_);
    ok( $? == 0 && -f $par, qq[successfully packed "$par"] );

    return $par;
}

my $par = pp_p_ok(-I => "t/data/blib/lib", -I => "t/data/blib/arch", 
                  -e => "use XSFoo;");

my ($out, $err) = run_ok($^X, "-MPAR=$par", -e => "use XSFoo; XSFoo::hello()");
like($out, qr/greetings from XSFoo/, "output from XSFoo::hello matches");