Test 4 in t/old-base.t fails in several places for MSWin32 because in
URL::URI->newlocal() doesn't escape the ':' in C:/TEMP. It also puts two
slashes after 'file:' at least for file specifications that include a drive
letter.
I am not sure what should be fixed the test or the base code, but the patch
below is for the test. It also allows the t/old-base.t to continue after a
subtest fails.
OS: WinNT 4.0 SP4
Perl: 5.6.0 (gcc)
--
Mac :})
t\old-base..........ok 3/8'file://C:/TEMP/'->as_string() = 'file://C:/TEMP/'
(expected 'file:C%3A/TEMP/')
$VAR1 = bless( [
bless( do{\(my $o = 'file://C:/TEMP/')}, 'URI::file' )
], 'URI::URL' );
Test Failed at t\old-base.t line 22
URI::URL::_expect('file://C:/TEMP/', 'as_string', 'file:C%3A/TEMP/')
called at t\old-base.t line 675
main::newlocal_test() called at t\old-base.t line 64
t\old-base..........dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 4-8
Failed 5/8 tests, 37.50% okay
# Inconsistent results from URI::URL->newlocal() in MSWin32 causes
# failures in t/old-base.t test 4
# From [EMAIL PROTECTED]
#
# To apply this patch:
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'applypatch' program with this patch file as input.
#
# If you do not have 'applypatch', it is part of the 'makepatch' package
# that you can fetch from the Comprehensive Perl Archive Network:
# http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz
# In the above URL, 'x' should be 2 or higher.
#
# To apply this patch without the use of 'applypatch':
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'patch' program with this file as input.
#
#### End of Preamble ####
#### Patch data follows ####
diff -ub 'old\URI-1.06\t\old-base.t' 'new\URI-1.06\t\old-base.t'
Index: ./t/old-base.t
--- ./t/old-base.t Fri Apr 7 05:56:34 2000
+++ ./t/old-base.t Sun Apr 9 18:36:24 2000
@@ -3,8 +3,6 @@
use URI::URL qw(url);
use URI::Escape qw(uri_escape uri_unescape);
-use Carp;
-
# _expect()
#
# Handy low-level object method tester which we insert as a method
@@ -19,7 +17,7 @@
warn "'$self'->$method(@args) = '$result' " .
"(expected '$expect')\n";
$self->print_on('STDERR');
- confess "Test Failed";
+ die "Test Failed";
}
package main;
@@ -52,30 +50,36 @@
print "Self tests for URI::URL version $URI::URL::VERSION...\n";
-scheme_parse_test();
+eval { scheme_parse_test(); };
+print "not " if $@;
print "ok 1\n";
-parts_test();
+eval { parts_test(); };
+print "not " if $@;
print "ok 2\n";
-escape_test();
+eval { escape_test(); };
+print "not " if $@;
print "ok 3\n";
-newlocal_test();
+eval { newlocal_test(); };
+print "not " if $@;
print "ok 4\n";
-absolute_test();
+eval { absolute_test(); };
+print "not " if $@;
print "ok 5\n";
-eq_test();
+eval { eq_test(); };
+print "not " if $@;
print "ok 6\n";
-# Let's test makeing our own things
+# Let's test making our own things
URI::URL::strict(0);
# This should work after URI::URL::strict(0)
$url = new URI::URL "x-myscheme:something";
# Since no implementor is registered for 'x-myscheme' then it will
-# be handeled by the URI::URL::_generic class
+# be handled by the URI::URL::_generic class
$url->_expect('as_string' => 'x-myscheme:something');
$url->_expect('path' => 'something');
URI::URL::strict(1);
@@ -640,11 +644,12 @@
return 1 if $^O eq "MacOS";
print "newlocal_test:\n";
- my $pwd = ($^O eq 'MSWin32' ? 'cd' :
+ my $isMSWin32 = ($^O =~ /MSWin32/i);
+ my $pwd = ($isMSWin32 ? 'cd' :
($^O eq 'qnx' ? '/usr/bin/fullpath -t' :
($^O eq 'VMS' ? 'show default' :
(-e '/bin/pwd' ? '/bin/pwd' : 'pwd'))));
- my $tmpdir = ($^O eq 'MSWin32' ? $ENV{TEMP} : '/tmp');
+ my $tmpdir = ($isMSWin32 ? $ENV{TEMP} : '/tmp');
if ( $^O eq 'qnx' ) {
$tmpdir = `/usr/bin/fullpath -t $tmpdir`;
chomp $tmpdir;
@@ -653,7 +658,7 @@
$tmpdir =~ tr|\\|/|;
my $savedir = `$pwd`; # we don't use Cwd.pm because we want to
check
- # that it get require'd corretly by URL.pm
+ # that it gets require'd correctly by URL.pm
chomp $savedir;
if ($^O eq 'VMS') {
$savedir =~ s#^\s+##;
@@ -671,8 +676,10 @@
$dir =~ s#/$##;
}
$dir = uri_escape($dir, ':');
+ $dir =~ s/^(\w)%3A/$1:/ if $isMSWin32;
$url = newlocal URI::URL;
- $url->_expect('as_string', URI::URL->new("file:$dir/")->as_string);
+ my $ss = $isMSWin32 ? '//' : '';
+ $url->_expect('as_string', URI::URL->new("file:$ss$dir/")->as_string);
print "Local directory is ". $url->local_path . "\n";
@@ -697,8 +704,9 @@
$dir =~ s#/$##;
}
$dir = uri_escape($dir, ':');
+ $dir =~ s/^(\w)%3A/$1:/ if $isMSWin32;
$url = newlocal URI::URL 'foo';
- $url->_expect('as_string', "file:$dir/foo");
+ $url->_expect('as_string', "file:$ss$dir/foo");
# relative dir
chdir($tmpdir) or die $!;
@@ -710,8 +718,9 @@
$dir =~ s#/$##;
}
$dir = uri_escape($dir, ':');
+ $dir =~ s/^(\w)%3A/$1:/ if $isMSWin32;
$url = newlocal URI::URL 'bar/';
- $url->_expect('as_string', "file:$dir/bar/");
+ $url->_expect('as_string', "file:$ss$dir/bar/");
# 0
if ($^O ne 'VMS') {
@@ -719,8 +728,9 @@
$dir = `$pwd`; $dir =~ tr|\\|/|;
chomp $dir;
$dir = uri_escape($dir, ':');
+ $dir =~ s/^(\w)%3A/$1:/ if $isMSWin32;
$url = newlocal URI::URL '0';
- $url->_expect('as_string', "file:${dir}0");
+ $url->_expect('as_string', "file:$ss${dir}0");
}
# Test access methods for file URLs
#### End of Patch data ####
#### ApplyPatch data follows ####
# Data version : 1.0
# Date generated : Sun Apr 9 18:37:09 2000
# Generated by : makepatch 2.00_03
# Recurse directories : Yes
# Excluded files : (\A|.*/)CVS(/.*|\Z)
# (\A|.*/)RCS(/.*|\Z)
# ,v\Z
# (\A|.*/)SCCS(/.*|\Z)
# (\A|.*/)[sp]\..+\Z
# p 't/old-base.t' 32812 955330584 0100666
#### End of ApplyPatch data ####
#### End of Patch kit [created: Sun Apr 9 18:37:09 2000] ####
#### Patch checksum: 153 4464 56257 ####
#### Checksum: 173 5215 53425 ####