Update of /cvsroot/openinteract/OpenInteract2/t
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23932/t
Modified Files:
url.t
Log Message:
OIN-79: update OI2::URL to escape the given base URL as well as the query arguments; update tests to check
Index: url.t
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract2/t/url.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** url.t 17 Nov 2003 05:05:42 -0000 1.10
--- url.t 4 Oct 2004 04:06:22 -0000 1.11
***************
*** 7,11 ****
require 'utils.pl';
use OpenInteract2::Context qw( CTX );
! use Test::More tests => 86;
initialize_context();
--- 7,11 ----
require 'utils.pl';
use OpenInteract2::Context qw( CTX );
! use Test::More tests => 96;
initialize_context();
***************
*** 17,21 ****
{
my ( $relative_url );
-
$relative_url = $UCL->parse_absolute_to_relative( '/foo/bar' );
is( $relative_url, '/foo/bar',
--- 17,20 ----
***************
*** 25,29 ****
{
my ( $action_name, $task );
-
( $action_name, $task ) = $UCL->parse( 'http://www.infocom.com/games/explore/' );
is( $action_name, 'games',
--- 24,27 ----
***************
*** 141,144 ****
--- 139,158 ----
compare_urls( '/foo', \%multiple_q, $create_url,
'Multiple query items' );
+
+ my @unescaped = ( '~', '.', '-', '*', "'", '(', ')', '/' );
+ foreach my $c ( @unescaped ) {
+ $create_url = $UCL->create( '/' . $c . 'lachoy/foo' );
+ is( $create_url, '/' . $c . 'lachoy/foo',
+ qq{..."$c" not escaped } );
+ }
+
+ $create_url = $UCL->create( '/some path/to/La Choy' );
+ is( $create_url, '/some%20path/to/La%20Choy',
+ '...spaces escaped with "%20" in path' );
+
+ $create_url = $UCL->create( '/some path/to/La Choy',
+ { emulate => 'Stan Granite' } );
+ is( $create_url, '/some%20path/to/La%20Choy?emulate=Stan%20Granite',
+ 'Path with spaces, query item with space' );
}
|