This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Nit in perlre.pod
[perl5.git] / os2 / os2_base.t
CommitLineData
30500b05
IZ
1#!/usr/bin/perl -w
2BEGIN {
3 chdir 't' if -d 't';
4 @INC = '../lib';
5}
6
6ebe41ac 7use Test::More tests => 19;
30500b05
IZ
8use strict;
9use Config;
10
11my $cwd = Cwd::sys_cwd();
30500b05
IZ
12ok -d $cwd;
13
14my $lpb = Cwd::extLibpath;
30500b05
IZ
15$lpb .= ';' unless $lpb and $lpb =~ /;$/;
16
17my $lpe = Cwd::extLibpath(1);
30500b05
IZ
18$lpe .= ';' unless $lpe and $lpe =~ /;$/;
19
20ok Cwd::extLibpath_set("$lpb$cwd");
21
22$lpb = Cwd::extLibpath;
30500b05
IZ
23$lpb =~ s#\\#/#g;
24(my $s_cwd = $cwd) =~ s#\\#/#g;
25
26like($lpb, qr/\Q$s_cwd/);
27
28ok Cwd::extLibpath_set("$lpe$cwd", 1);
29
30$lpe = Cwd::extLibpath(1);
30500b05
IZ
31$lpe =~ s#\\#/#g;
32
33like($lpe, qr/\Q$s_cwd/);
34
59ad941d
IZ
35if (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}
30500b05
IZ
46is(OS2::DLLname, OS2::DLLname(2));
47like(OS2::DLLname(0), qr#^(\d+)$# );
48
49
50is(OS2::DLLname($_), OS2::DLLname($_, \&Cwd::extLibpath) ) for 0..2;
51ok(not defined eval { OS2::DLLname $_, \&Cwd::cwd; 1 } ) for 0..2;
52ok(not defined eval { OS2::DLLname $_, \&xxx; 1 } ) for 0..2;