1 | #!/usr/bin/perl -w
|
---|
2 | BEGIN {
|
---|
3 | chdir 't' if -d 't';
|
---|
4 | @INC = '../lib';
|
---|
5 | }
|
---|
6 |
|
---|
7 | use Test::More tests => 19;
|
---|
8 | use strict;
|
---|
9 | use Config;
|
---|
10 |
|
---|
11 | my $cwd = Cwd::sys_cwd();
|
---|
12 | ok -d $cwd;
|
---|
13 |
|
---|
14 | my $lpb = Cwd::extLibpath;
|
---|
15 | $lpb .= ';' unless $lpb and $lpb =~ /;$/;
|
---|
16 |
|
---|
17 | my $lpe = Cwd::extLibpath(1);
|
---|
18 | $lpe .= ';' unless $lpe and $lpe =~ /;$/;
|
---|
19 |
|
---|
20 | ok Cwd::extLibpath_set("$lpb$cwd");
|
---|
21 |
|
---|
22 | $lpb = Cwd::extLibpath;
|
---|
23 | $lpb =~ s#\\#/#g;
|
---|
24 | (my $s_cwd = $cwd) =~ s#\\#/#g;
|
---|
25 |
|
---|
26 | like($lpb, qr/\Q$s_cwd/);
|
---|
27 |
|
---|
28 | ok Cwd::extLibpath_set("$lpe$cwd", 1);
|
---|
29 |
|
---|
30 | $lpe = Cwd::extLibpath(1);
|
---|
31 | $lpe =~ s#\\#/#g;
|
---|
32 |
|
---|
33 | like($lpe, qr/\Q$s_cwd/);
|
---|
34 |
|
---|
35 | if (uc OS2::DLLname() eq uc $^X) { # Static build
|
---|
36 | my ($short) = ($^X =~ m,.*[/\\]([^.]+),);
|
---|
37 | is(uc OS2::DLLname(1), uc $short);
|
---|
38 | is(uc OS2::DLLname, uc $^X ); # automatically
|
---|
39 | is(1,1); # automatically...
|
---|
40 | } else {
|
---|
41 | is(uc OS2::DLLname(1), uc $Config{dll_name});
|
---|
42 | like(OS2::DLLname, qr#\Q/$Config{dll_name}\E\.dll$#i );
|
---|
43 | (my $root_cwd = $s_cwd) =~ s,/t$,,;
|
---|
44 | like(OS2::DLLname, qr#^\Q$root_cwd\E(/t)?\Q/$Config{dll_name}\E\.dll#i );
|
---|
45 | }
|
---|
46 | is(OS2::DLLname, OS2::DLLname(2));
|
---|
47 | like(OS2::DLLname(0), qr#^(\d+)$# );
|
---|
48 |
|
---|
49 |
|
---|
50 | is(OS2::DLLname($_), OS2::DLLname($_, \&Cwd::extLibpath) ) for 0..2;
|
---|
51 | ok(not defined eval { OS2::DLLname $_, \&Cwd::cwd; 1 } ) for 0..2;
|
---|
52 | ok(not defined eval { OS2::DLLname $_, \&xxx; 1 } ) for 0..2;
|
---|