4 use Test::More tests => 9;
6 use_ok( 'URI::Template' );
9 my $text = 'http://foo.com/{arg2}/{arg1}';
10 my $template = URI::Template->new( $text );
11 isa_ok( $template, 'URI::Template' );
12 is_deeply( [ $template->all_variables ], [ qw( arg2 arg1 ) ], 'all_variables()' );
15 my $result = $template->process( [ qw( x y ) ] );
16 is( $result, 'http://foo.com/x/y', 'process(\@args)' );
17 isa_ok( $result, 'URI', 'return value from process() isa URI' );
21 my $result = $template->process_to_string( [ qw( x y ) ] );
22 is( $result, 'http://foo.com/x/y', 'process_to_string(\@args)' );
23 ok( !ref $result, 'result is not a ref' );
28 my $result = $template->process_to_string( [ qw( 0 0 ) ] );
29 is( $result, 'http://foo.com/0/0', 'process w/ 0' );
34 my $result = $template->process_to_string( [ ] );
35 is( $result, 'http://foo.com//', 'process w/ no values' );