Re: Should this fail?

Gisle Aas (aas@oslonett.no)
Fri, 03 Nov 1995 10:19:21 +0100


> base/uri............'file:/External1/tmp/'->as_string() = 'file:/External1/tmp/' (expected 'file:/tmp/')
> Dump of URL file:/External1/tmp/...
>   _str  'file:/External1/tmp/'
>   path  '/External1/tmp/'
>   scheme        'file'
> Test Failed at base/uri.t line 23
>         URI::URL::_generic::_expect called at base/uri.t line 329
>         main::newlocal_test called at base/uri.t line 47
> FAILED on test 4

This patch (provided by Martijn) to uri.t should probably fix your problem.  5b5 assumed that the Cwd-routines would return "/tmp" after we had done chdir("/tmp").

--Gisle


RCS file: /local/src/CVSROOT/perl/mods/libwww-perl/t/base/uri.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- uri.t       1995/09/15 17:03:18     1.5
+++ uri.t       1995/10/18 09:58:13     1.6
@@ -319,14 +319,17 @@
 
 sub newlocal_test {
     print "newlocal_test:\n";
-
-    my $dir =`/bin/pwd`;        # check Cwd gets require'd
-    chomp $dir;
-
+ 
+    my $savedir =`/bin/pwd`;  # we don't use Cwd.pm because we want to check
+                              # that it get require'd corretly by URL.pm
+    chomp $savedir;
+    
     # cwd
     chdir('/tmp') or die $!;
+    my $dir = `/bin/pwd`;
+    chomp $dir;
     $url = newlocal URI::URL;
-    $url->_expect('as_string', 'file:/tmp/');
+    $url->_expect('as_string', "file:$dir/");
 
     # absolute dir
     chdir('/') or die $!;
@@ -339,20 +342,24 @@
 
     # relative file
     chdir('/tmp') or die $!;
+    $dir = `/bin/pwd`;
+    chomp $dir;
     $url = newlocal URI::URL 'foo';
-    $url->_expect('as_string', 'file:/tmp/foo');
+    $url->_expect('as_string', "file:$dir/foo");
 
     # relative dir
     chdir('/tmp') or die $!;
+    $dir = `/bin/pwd`;
+    chomp $dir;
     $url = newlocal URI::URL 'bar/';
-    $url->_expect('as_string', 'file:/tmp/bar/');
+    $url->_expect('as_string', "file:$dir/bar/");
 
     # 0
     chdir('/') or die $!;
     $url = newlocal URI::URL '0';
     $url->_expect('as_string', 'file:/0');
 
-    chdir($dir) or die $!;
+    chdir($savedir) or die $!;
 }