File: 85-myfile.t

package info (click to toggle)
libpar-packer-perl 1.063-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,380 kB
  • sloc: perl: 12,859; ansic: 1,486; makefile: 30; sh: 5
file content (38 lines) | stat: -rw-r--r-- 877 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
38
#!/usr/bin/perl

use strict;
use warnings;

use Cwd;
use File::Spec::Functions;

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

plan tests => 6;

my $exe = pp_ok(-I => "t/data/lib", -e => <<'...');
use Cwd;
use Data::Dumper;
use Myfile;
my $data = 
{ 
    par_temp    => Cwd::realpath($ENV{PAR_TEMP}), 
    from_file   => Myfile::from_file(), 
    from_caller => Myfile::from_caller(), 
};
print Data::Dumper->new([$data], ['data'])->Useqq(1)->Dump;
...

my ($out, $err) = run_ok($exe);

our $data;
eval($out);

my $exp_file = catfile($data->{par_temp}, qw( inc lib Myfile.pm ));
$exp_file =~ s{\\}{/}g if $^O eq 'MSWin32';

is($data->{from_file}, $exp_file, "expected source path from __FILE__");
ok(-e $data->{from_file}, "file __FILE__ exists");
is($data->{from_caller}, $exp_file, "expected source path from (caller)[1]");
ok(-e $data->{from_caller}, "file (caller)[1] exists");