Commit | Line | Data |
---|---|---|
30500b05 IZ |
1 | #!/usr/bin/perl -w |
2 | BEGIN { | |
3 | chdir 't' if -d 't'; | |
4 | @INC = '../lib'; | |
5 | } | |
6 | ||
7 | use Test::More tests => 24; | |
8 | use strict; | |
9 | use Config; | |
10 | ||
11 | my $cwd = Cwd::sys_cwd(); | |
12 | ok 1; | |
13 | ok -d $cwd; | |
14 | ||
15 | my $lpb = Cwd::extLibpath; | |
16 | ok 1; | |
17 | $lpb .= ';' unless $lpb and $lpb =~ /;$/; | |
18 | ||
19 | my $lpe = Cwd::extLibpath(1); | |
20 | ok 1; | |
21 | $lpe .= ';' unless $lpe and $lpe =~ /;$/; | |
22 | ||
23 | ok Cwd::extLibpath_set("$lpb$cwd"); | |
24 | ||
25 | $lpb = Cwd::extLibpath; | |
26 | ok 1; | |
27 | $lpb =~ s#\\#/#g; | |
28 | (my $s_cwd = $cwd) =~ s#\\#/#g; | |
29 | ||
30 | like($lpb, qr/\Q$s_cwd/); | |
31 | ||
32 | ok Cwd::extLibpath_set("$lpe$cwd", 1); | |
33 | ||
34 | $lpe = Cwd::extLibpath(1); | |
35 | ok 1; | |
36 | $lpe =~ s#\\#/#g; | |
37 | ||
38 | like($lpe, qr/\Q$s_cwd/); | |
39 | ||
40 | is(uc OS2::DLLname(1), uc $Config{dll_name}); | |
41 | like(OS2::DLLname, qr#\Q/$Config{dll_name}\E\.dll$#i ); | |
42 | (my $root_cwd = $s_cwd) =~ s,/t$,,; | |
43 | like(OS2::DLLname, qr#^\Q$root_cwd\E(/t)?\Q/$Config{dll_name}\E\.dll#i ); | |
44 | is(OS2::DLLname, OS2::DLLname(2)); | |
45 | like(OS2::DLLname(0), qr#^(\d+)$# ); | |
46 | ||
47 | ||
48 | is(OS2::DLLname($_), OS2::DLLname($_, \&Cwd::extLibpath) ) for 0..2; | |
49 | ok(not defined eval { OS2::DLLname $_, \&Cwd::cwd; 1 } ) for 0..2; | |
50 | ok(not defined eval { OS2::DLLname $_, \&xxx; 1 } ) for 0..2; | |
35bc1fdc IZ |
51 | print "1.." . lasttest() . "\n"; |
52 | ||
53 | $cwd = Cwd::sys_cwd(); | |
54 | print "ok 1\n"; | |
55 | print "not " unless -d $cwd; | |
56 | print "ok 2\n"; | |
57 | ||
58 | $lpb = Cwd::extLibpath; | |
59 | print "ok 3\n"; | |
60 | $lpb .= ';' unless $lpb and $lpb =~ /;$/; | |
61 | ||
62 | $lpe = Cwd::extLibpath(1); | |
63 | print "ok 4\n"; | |
64 | $lpe .= ';' unless $lpe and $lpe =~ /;$/; | |
65 | ||
66 | Cwd::extLibpath_set("$lpb$cwd") or print "not "; | |
67 | print "ok 5\n"; | |
68 | ||
69 | $lpb = Cwd::extLibpath; | |
70 | print "ok 6\n"; | |
71 | $lpb =~ s#\\#/#g; | |
72 | ($s_cwd = $cwd) =~ s#\\#/#g; | |
73 | ||
74 | print "not " unless $lpb =~ /\Q$s_cwd/; | |
75 | print "ok 7\n"; | |
76 | ||
77 | Cwd::extLibpath_set("$lpe$cwd", 1) or print "not "; | |
78 | print "ok 8\n"; | |
79 | ||
80 | $lpe = Cwd::extLibpath(1); | |
81 | print "ok 9\n"; | |
82 | $lpe =~ s#\\#/#g; | |
83 | ||
84 | print "not " unless $lpe =~ /\Q$s_cwd/; | |
85 | print "ok 10\n"; | |
86 | ||
87 | unshift @INC, 'lib'; | |
88 | require OS2::Process; | |
30500b05 | 89 | my @l = OS2::Process::process_entry(); |
35bc1fdc IZ |
90 | print "not " unless @l == 11; |
91 | print "ok 11\n"; | |
92 | ||
93 | # 1: FS 2: Window-VIO | |
94 | print "not " unless $l[9] == 1 or $l[9] == 2; | |
95 | print "ok 12\n"; | |
96 | ||
97 | print "# $_\n" for @l; | |
98 | ||
99 | sub lasttest {12} |