[svk-commit] r2784 - in trunk: lib/SVK
nobody at bestpractical.com
nobody at bestpractical.com
Thu May 1 09:09:52 EDT 2008
Author: clsung
Date: Thu May 1 09:09:51 2008
New Revision: 2784
Added:
trunk/t/uri-escape-util.t
Modified:
trunk/lib/SVK/Util.pm
Log:
- fix svn+ssh://user@domain.com/ uri escape error
- current tests only test uri_escape, none for uri_unescape
Modified: trunk/lib/SVK/Util.pm
==============================================================================
--- trunk/lib/SVK/Util.pm (original)
+++ trunk/lib/SVK/Util.pm Thu May 1 09:09:51 2008
@@ -1024,7 +1024,7 @@
sub uri_escape {
my ($uri) = @_;
- $uri =~ s/([^0-9A-Za-z%+\-\/:_.!~*'()])/sprintf("%%%02X", ord($1))/eg;
+ $uri =~ s/([^0-9A-Za-z@%+\-\/:_.!~*'()])/sprintf("%%%02X", ord($1))/eg;
return $uri;
}
Added: trunk/t/uri-escape-util.t
==============================================================================
--- (empty file)
+++ trunk/t/uri-escape-util.t Thu May 1 09:09:51 2008
@@ -0,0 +1,21 @@
+#!/usr/bin/perl -w
+use strict;
+use SVK::Test;
+use SVK::Util qw(uri_escape uri_unescape);
+
+# test uri escape here
+# key for input, value for output
+my %uris = (
+ 'svn+ssh://foo@bar.bestpractical.com/svn/bps-nonsense'
+ => 'svn+ssh://foo@bar.bestpractical.com/svn/bps-nonsense',
+ 'http://bar.bestpractical.com/svn/bps-nonsense'
+ => 'http://bar.bestpractical.com/svn/bps-nonsense',
+ 'http://bar.bestpractical.com/B and K/A/N P1/trunk'
+ => 'http://bar.bestpractical.com/B%20and%20K/A/N%20P1/trunk',
+);
+
+plan tests => (scalar keys %uris);
+
+for my $uri (keys %uris) {
+ is (uri_escape($uri), $uris{$uri});
+}
More information about the svk-commit
mailing list