File: resolvepathes.t

package info (click to toggle)
libgetopt-argvfile-perl 1.11-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 260 kB
  • sloc: perl: 347; makefile: 2
file content (70 lines) | stat: -rw-r--r-- 1,170 bytes parent folder | download | duplicates (4)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

# set pragma
use strict;

# load test module
use Test::More qw(no_plan);

# load the module
use Getopt::ArgvFile qw(argvFile);

# load helper modules
use Cwd;
use File::Basename;

# do not resolve
argvFile(default=>1);

# declare expected result
my @expected=(
              '-file1',
              './file1',

              '-file2',
              '../file2',

              '-file2',
              './../file2',

              '-file1',
              "../././t/file1",
             );

# perform first check
is(@ARGV, @expected);
is_deeply(\@ARGV, \@expected);



# now resolve
@ARGV=();
argvFile(default=>1, resolveRelativePathes=>1);

# get current *run* path
my $currentPath=cwd();
my $parentPath=dirname($currentPath);

# declare expected result (for "make test" which is started one level up)
@expected=(
           '-file1',
           "$currentPath/t/file1",

           '-file2',
           "$currentPath/file2",

           '-file2',
           "$currentPath/file2",

           '-file1',
           "$currentPath/t/file1",

           '-nested',
           'file',
          );

# perform first check
is(@ARGV, @expected);
is_deeply(\@ARGV, \@expected);