xref: /openbsd-src/gnu/usr.bin/perl/os2/os2_base.t (revision 8500990981f885cbe5e6a4958549cacc238b5ae6)
155745691Smillert#!/usr/bin/perl -w
255745691SmillertBEGIN {
355745691Smillert    chdir 't' if -d 't';
455745691Smillert    @INC = '../lib';
555745691Smillert}
655745691Smillert
755745691Smillertuse Test::More tests => 19;
855745691Smillertuse strict;
955745691Smillertuse Config;
1055745691Smillert
1155745691Smillertmy $cwd = Cwd::sys_cwd();
1255745691Smillertok -d $cwd;
1355745691Smillert
1455745691Smillertmy $lpb = Cwd::extLibpath;
1555745691Smillert$lpb .= ';' unless $lpb and $lpb =~ /;$/;
1655745691Smillert
1755745691Smillertmy $lpe = Cwd::extLibpath(1);
1855745691Smillert$lpe .= ';' unless $lpe and $lpe =~ /;$/;
1955745691Smillert
2055745691Smillertok Cwd::extLibpath_set("$lpb$cwd");
2155745691Smillert
2255745691Smillert$lpb = Cwd::extLibpath;
2355745691Smillert$lpb =~ s#\\#/#g;
2455745691Smillert(my $s_cwd = $cwd) =~ s#\\#/#g;
2555745691Smillert
2655745691Smillertlike($lpb, qr/\Q$s_cwd/);
2755745691Smillert
2855745691Smillertok Cwd::extLibpath_set("$lpe$cwd", 1);
2955745691Smillert
3055745691Smillert$lpe = Cwd::extLibpath(1);
3155745691Smillert$lpe =~ s#\\#/#g;
3255745691Smillert
3355745691Smillertlike($lpe, qr/\Q$s_cwd/);
3455745691Smillert
35*85009909Smillertif (uc OS2::DLLname() eq uc $^X) {	# Static build
36*85009909Smillert  my ($short) = ($^X =~ m,.*[/\\]([^.]+),);
37*85009909Smillert  is(uc OS2::DLLname(1), uc $short);
38*85009909Smillert  is(uc OS2::DLLname, uc $^X );		# automatically
39*85009909Smillert  is(1,1);				# automatically...
40*85009909Smillert} else {
4155745691Smillert  is(uc OS2::DLLname(1), uc $Config{dll_name});
4255745691Smillert  like(OS2::DLLname, qr#\Q/$Config{dll_name}\E\.dll$#i );
4355745691Smillert  (my $root_cwd = $s_cwd) =~ s,/t$,,;
4455745691Smillert  like(OS2::DLLname, qr#^\Q$root_cwd\E(/t)?\Q/$Config{dll_name}\E\.dll#i );
45*85009909Smillert}
4655745691Smillertis(OS2::DLLname, OS2::DLLname(2));
4755745691Smillertlike(OS2::DLLname(0), qr#^(\d+)$# );
4855745691Smillert
4955745691Smillert
5055745691Smillertis(OS2::DLLname($_), OS2::DLLname($_, \&Cwd::extLibpath) ) for 0..2;
5155745691Smillertok(not defined eval { OS2::DLLname $_, \&Cwd::cwd; 1 } ) for 0..2;
5255745691Smillertok(not defined eval { OS2::DLLname $_, \&xxx; 1 } ) for 0..2;
53