| 1 | |||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use Test::More; | ||
| 5 | |||
| 6 | use_ok 'HTML::TurboForm'; | ||
| 7 | |||
| 8 | { # new() - fails as a hashref is required | ||
| 9 | my $form = HTML::TurboForm->new(); | ||
| 10 | $form->add_element({ type => "Text", name => 'query' }); | ||
| 11 | $form->populate({ query => 'Question' }); | ||
| 12 | is $form->get_value('query'), 'Question', " .. new(), .. get_value('query')"; | ||
| 13 | } | ||
| 14 | { # new( {} ) - ok | ||
| 15 | my $form = HTML::TurboForm->new({}); # a hashref is required | ||
| 16 | $form->add_element({ type => "Text", name => 'query' }); | ||
| 17 | $form->populate({ query => 'Question' }); | ||
| 18 | is $form->get_value('query'), 'Question', " .. new({}), .. get_value('query')"; | ||
| 19 | } | ||
| 20 | done_testing; |