This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add File::Temp's OO test.
[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
35is(uc OS2::DLLname(1), uc $Config{dll_name});
36like(OS2::DLLname, qr#\Q/$Config{dll_name}\E\.dll$#i );
37(my $root_cwd = $s_cwd) =~ s,/t$,,;
38like(OS2::DLLname, qr#^\Q$root_cwd\E(/t)?\Q/$Config{dll_name}\E\.dll#i );
39is(OS2::DLLname, OS2::DLLname(2));
40like(OS2::DLLname(0), qr#^(\d+)$# );
41
42
43is(OS2::DLLname($_), OS2::DLLname($_, \&Cwd::extLibpath) ) for 0..2;
44ok(not defined eval { OS2::DLLname $_, \&Cwd::cwd; 1 } ) for 0..2;
45ok(not defined eval { OS2::DLLname $_, \&xxx; 1 } ) for 0..2;