;
Dear {{to}},
Have a {{day_type}} day.
Your {{relation}},
{{from}}
END_TEMPLATE
};
$x = $@;
isnt $x, q{}, q{Bad second argument to 'new'};
ok (Text::Printf::X->caught(), q{Bad-arg exception c
--------------------------
eval
{
$template = Text::Printf->new({a=>1}, 'burp');
};
$x = $@;
isnt $x, q{}, q{Out-of-order arguments to 'new'};
ok(Text::Printf::X->caught(), q{Out-of-order exce
------------------
eval
{
$template = Text::Printf->new('whee', 'oops', 'burp');
};
$x = $@;
isnt $x, q{}, q{Too many arguments to 'new'};
ok(Text::Printf::X->caught(), q{Too many exception ca
($template, $letter, $x);
# tprintf with no args (4)
eval
{
$letter = tprintf();
};
$x = $@;
isnt $x, q{}, q{No args to tprintf};
ok(Text::Printf::X->caught(), q{No-args printf exception caugh
too};
# tprintf with only filehandle arg (4)
eval
{
$letter = tprintf(\*STDOUT);
};
$x = $@;
isnt $x, q{}, q{Only filehandle arg to tprintf};
ok(Text::Printf::X->caught(), q{One-arg printf exc
orks as a string, too};
# tsprintf with no args (4)
eval
{
$letter = tsprintf();
};
$x = $@;
isnt $x, q{}, q{No args to tsprintf};
ok(Text::Printf::X->caught(), q{No-args sprintf exception cau
q{Created test template};
eval
{
$letter = $template->fill(qw/bad arguments/);
};
$x = $@;
isnt $x, q{}, q{No hashref args to fill};
ok(Text::Printf::X->caught(), q{Not-hashref exception cau
ks as a string, too};
eval
{
$letter = $template->fill({foo => 'bar'}, 'burp');
};
$x = $@;
isnt $x, q{}, q{Not all args are hashref};
ok(Text::Printf::X->caught(), q{Not-all-hashrefs excepti
->fill({to => 'Lord Voldemort'},
{from => 'Harry'});
};
$x = $@;
isnt $x, q{}, q{Not all symbols resolved};
ok(Text::Printf::X->caught(), q{Not-all-symbols exceptio
-----------------------
eval
{
$letter = $template->text('help', 'help');
};
$x = $@;
isnt $x, q{}, q{Too many parameters to text()};
ok(Text::Printf::X->caught(), q{Too-many parameters
--------------------------------
eval
{
$letter = $template->text(undef);
};
$x = $@;
isnt $x, q{}, q{text(undef)};
ok(Text::Printf::X->caught(), q{text(undef) exception caught});
ok
l({to => 'Lord Voldemort'},
{from => 'Harry'});
};
$x = $@;
isnt $x, q{}, q{fill() with no text};
ok(Text::Printf::X->caught(), q{fill-no-text ex
essor Dumbledore'},
'bass guitarist for the Weird Sisters');
};
$x = $@;
isnt $x, q{}, q{Exception for bad args to pre_fill};
ok (Text::Printf::X->caught(), q{bad-args excep
essor Dumbledore'},
'bass guitarist for the Weird Sisters');
};
$x = $@;
isnt $x, q{}, q{Exception for bad args to default};
ok (Text::Printf::X->caught(), q{bad-args except
A Reference'});
$template->clear_values;
eval
{
$template->fill({aref => 'foo'});
};
$x = $@;
isnt $x, q{}, q{clear: Not all symbols resolved};
ok(Text::Printf::X->caught(), q{clear: exception c
ibliography 2});
eval
{
$bibl_3 = $book_t->fill({author => 'Isaac Asimov'});
};
my $x = $@;
isnt ($x, q{}, q{Exception when creating bibliography 3});
ok (Text::Printf::X->caught(), q{Proper ba