Navigation Menu

Skip to content

Commit

Permalink
a few more tests for Mojo::Path and Mojo::Parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 11, 2013
1 parent 436144c commit 938549a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

3.90 2013-03-10
3.90 2013-03-11
- Added direct array access for parsed parameters to Mojo::Parameters.
- Added direct array access for path parts to Mojo::Path.
- Improved dumper helper to sort hash keys.
Expand Down
10 changes: 7 additions & 3 deletions t/mojo/parameters.t
Expand Up @@ -22,16 +22,20 @@ is "$params", 'foo=b%3Bar;baz=23', 'right format';

# Append
is_deeply $params->params, ['foo', 'b;ar', 'baz', 23], 'right structure';
$params->append('a', 4, 'a', 5, 'b', 6, 'b', 7);
$params->append(a => 4, a => 5, b => 6, b => 7);
is $params->to_string, "foo=b%3Bar;baz=23;a=4;a=5;b=6;b=7", 'right format';
push @$params, c => 8;
is $params->to_string, "foo=b%3Bar;baz=23;a=4;a=5;b=6;b=7;c=8", 'right format';

# Clone
my $clone = $params->clone;
is "$params", "$clone", 'equal results';
is "$params", "$clone", 'equal parameters';
push @$clone, c => 9;
isnt "$params", "$clone", 'unequal parameters';

# Merge
$params->merge($params2);
is $params->to_string, 'foo=b%3Bar;baz=23;a=4;a=5;b=6;b=7;x=1;y=2',
is $params->to_string, 'foo=b%3Bar;baz=23;a=4;a=5;b=6;b=7;c=8;x=1;y=2',
'right format';
is $params2->to_string, 'x=1&y=2', 'right format';

Expand Down
2 changes: 2 additions & 0 deletions t/mojo/path.t
Expand Up @@ -29,6 +29,8 @@ is $path->[1], undef, 'no part';
ok $path->leading_slash, 'has leading slash';
ok !$path->trailing_slash, 'no trailing slash';
is "$path", '/AZaz09-._~!$&\'()*+,;=:@', 'right path';
push @$path, 'foo';
is "$path", '/AZaz09-._~!$&\'()*+,;=:@/foo', 'right path';

# Unicode
is $path->parse('/foo/♥/bar')->to_string, '/foo/%E2%99%A5/bar', 'right path';
Expand Down

0 comments on commit 938549a

Please sign in to comment.