projects
/
liburi-template-perl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 0.14.01
[liburi-template-perl.git]
/
t
/
10-basic.t
diff --git
a/t/10-basic.t
b/t/10-basic.t
index
4240367
..
934d87d
100644
(file)
--- a/
t/10-basic.t
+++ b/
t/10-basic.t
@@
-7,16
+7,16
@@
use_ok( 'URI::Template' );
# fatal - no template provided
{
# fatal - no template provided
{
- eval { URI::Template->new; };
- ok( $@ );
+
eval { URI::Template->new; };
+
ok( $@ );
}
{
my $text = 'http://foo.com/{bar}/{baz}?q=%7B';
my $template = URI::Template->new( $text );
isa_ok( $template, 'URI::Template' );
}
{
my $text = 'http://foo.com/{bar}/{baz}?q=%7B';
my $template = URI::Template->new( $text );
isa_ok( $template, 'URI::Template' );
- is_deeply( [ sort $template->variables ], [
qw( bar baz )
], 'variables()' );
- is( "$template", $text, '
as_string()
' );
+ is_deeply( [ sort $template->variables ], [
'bar', 'baz'
], 'variables()' );
+ is( "$template", $text, '
stringify
' );
{
my $result = $template->process( bar => 'x', baz => 'y' );
{
my $result = $template->process( bar => 'x', baz => 'y' );
@@
-43,7
+43,7
@@
use_ok( 'URI::Template' );
is( $result, 'http://foo.com/%7Bx%7D/', 'values are uri escaped' );
}
{
is( $result, 'http://foo.com/%7Bx%7D/', 'values are uri escaped' );
}
{
- my $result = $template->process(
);
+ my $result = $template->process();
is( $result, 'http://foo.com//', 'no value sent' );
}
{
is( $result, 'http://foo.com//', 'no value sent' );
}
{
@@
-54,7
+54,7
@@
use_ok( 'URI::Template' );
{
my $template = URI::Template->new( 'http://foo.com/{z}/{z}/' );
{
my $template = URI::Template->new( 'http://foo.com/{z}/{z}/' );
- is_deeply( [
$template->variables ], [ 'z' ], 'unique vars
' );
+ is_deeply( [
sort $template->variables ], [ 'z' ], 'no duplicates in variables()
' );
my $result = $template->process( 'z' => 'x' );
is( $result, 'http://foo.com/x/x/', 'multiple replaces' );
}
my $result = $template->process( 'z' => 'x' );
is( $result, 'http://foo.com/x/x/', 'multiple replaces' );
}