+ my $template = URI::Template->new;
+ isa_ok( $template, 'URI::Template' );
+
+ {
+ my $result = $template->process();
+ is( $result, '', 'process() for empty template' );
+ isa_ok( $result, 'URI', 'return value from process() isa URI' );
+ }
+}
+
+# "0" as a template
+{
+ my $template = URI::Template->new( '0' );
+ isa_ok( $template, 'URI::Template' );
+ is( $template->template, '0', 'template() is "0"' );
+
+ {
+ my $result = $template->process();
+ is( $result, '0', 'process() for "0" template' );
+ isa_ok( $result, 'URI', 'return value from process() isa URI' );
+ }
+
+ # set template back to empty
+ $template->template( '' );
+ is( $template->template, '', 'template() is empty' );
+
+ {
+ my $result = $template->process();
+ is( $result, '', 'process() for new empty template' );
+ isa_ok( $result, 'URI', 'return value from process() isa URI' );
+ }
+}
+
+# Update template
+{
+ my $template = URI::Template->new;
+ is( "$template", '', 'stringify from empty' );
+
+ my $text = 'http://foo.com/{bar}/{baz}';
+ $template->template($text);
+
+ is( "$template", $text, 'stringify from updated template' );
+
+ {
+ my $result = $template->process( bar => 'x', baz => 'y' );
+ is( $result, 'http://foo.com/x/y', 'process() for updated template' );
+ isa_ok( $result, 'URI', 'return value from process() isa URI' );
+ }