17 print +(defined(&cwd) &&
20 defined(&fastgetcwd) ?
21 "" : "not "), "ok 1\n";
22 print +(!defined(&chdir) &&
23 !defined(&abs_path) &&
24 !defined(&fast_abs_path) ?
25 "" : "not "), "ok 2\n";
27 # XXX force Cwd to bootsrap its XSUBs since we have set @INC = "../lib"
28 # XXX and subsequent chdir()s can make them impossible to find
31 # Must find an external pwd (or equivalent) command.
34 ($^O eq "MSWin32" || $^O eq "NetWare") ? "cd" : (grep { -x && -f } map { "$_/pwd" }
35 split m/$Config{path_sep}/, $ENV{PATH})[0];
37 if ($^O eq 'VMS') { $pwd_cmd = 'SHOW DEFAULT'; }
39 if (defined $pwd_cmd) {
40 chomp(my $start = `$pwd_cmd`);
41 # Win32's cd returns native C:\ style
42 $start =~ s,\\,/,g if ($^O eq 'MSWin32' || $^O eq "NetWare");
43 # DCL SHOW DEFAULT has leading spaces
44 $start =~ s/^\s+// if $^O eq 'VMS';
47 print "ok $_ # Skip: '$pwd_cmd' failed\n";
52 my $fastcwd = fastcwd;
53 my $fastgetcwd = fastgetcwd;
54 print +($cwd eq $start ? "" : "not "), "ok 3\n";
55 print +($getcwd eq $start ? "" : "not "), "ok 4\n";
56 print +($fastcwd eq $start ? "" : "not "), "ok 5\n";
57 print +($fastgetcwd eq $start ? "" : "not "), "ok 6\n";
61 print "ok $_ # Skip: no pwd command found\n";
65 mkpath(["_ptrslt_/_path_/_to_/_a_/_dir_"], 0, 0777);
66 Cwd::chdir "_ptrslt_/_path_/_to_/_a_/_dir_";
69 my $fastcwd = fastcwd;
70 my $fastgetcwd = fastgetcwd;
71 my $want = "t/_ptrslt_/_path_/_to_/_a_/_dir_";
72 print "# cwd = '$cwd'\n";
73 print "# getcwd = '$getcwd'\n";
74 print "# fastcwd = '$fastcwd'\n";
75 print "# fastgetcwd = '$fastgetcwd'\n";
76 # This checked out OK on ODS-2 and ODS-5:
77 $want = "T\.PTEERSLT\.PATH\.TO\.A\.DIR\]" if $^O eq 'VMS';
78 print +($cwd =~ m|$want$| ? "" : "not "), "ok 7\n";
79 print +($getcwd =~ m|$want$| ? "" : "not "), "ok 8\n";
80 print +($fastcwd =~ m|$want$| ? "" : "not "), "ok 9\n";
81 print +($fastgetcwd =~ m|$want$| ? "" : "not "), "ok 10\n";
83 # Cwd::chdir should also update $ENV{PWD}
85 print +($ENV{PWD} =~ m|$want$| ? "" : "not "), "ok 11\n";
97 rmtree(["_ptrslt_"], 0, 0);
100 # This checked out OK on ODS-2 and ODS-5:
101 print +($ENV{PWD} =~ m|\bT\]$| ? "" : "not "), "ok 12\n";
104 print +($ENV{PWD} =~ m|\bt$| ? "" : "not "), "ok 12\n";
107 if ($Config{d_symlink}) {
108 mkpath(["_ptrslt_/_path_/_to_/_a_/_dir_"], 0, 0777);
109 symlink "_ptrslt_/_path_/_to_/_a_/_dir_" => "linktest";
111 my $abs_path = Cwd::abs_path("linktest");
112 my $fast_abs_path = Cwd::fast_abs_path("linktest");
113 my $want = "t/_ptrslt_/_path_/_to_/_a_/_dir_";
115 print "# abs_path $abs_path\n";
116 print "# fast_abs_path $fast_abs_path\n";
117 print "# want $want\n";
118 print +($abs_path =~ m|$want$| ? "" : "not "), "ok 13\n";
119 print +($fast_abs_path =~ m|$want$| ? "" : "not "), "ok 14\n";
121 rmtree(["ptrslt"], 0, 0);
124 print "ok 13 # skipped\n";
125 print "ok 14 # skipped\n";