source: text-formbuilder/trunk/t/Text-FormBuilder.t @ 43

Last change on this file since 43 was 43, checked in by peter, 20 years ago

ignoring test

File size: 1.4 KB
Line 
1# Before `make install' is performed this script should be runnable with
2# `make test'. After `make install' it should work as `perl Text-FormBuilder.t'
3
4#########################
5
6# change 'tests => 1' to 'tests => last_test_to_print';
7
8use Test::More qw(no_plan); #tests => 6;
9BEGIN { use_ok('Text::FormBuilder'); };
10
11#########################
12
13# Insert your test code below, the Test::More module is use()ed here so read
14# its man page ( perldoc Test::More ) for help writing this test script.
15
16my $p = Text::FormBuilder->new;
17isa_ok($p, 'Text::FormBuilder', 'new parser');
18isa_ok($p->parse_text('')->build->form, 'CGI::FormBuilder',  'generated CGI::FormBuilder object (build->form)');
19isa_ok($p->parse_text('')->form,        'CGI::FormBuilder',  'generated CGI::FormBuilder object (form)');
20
21$p = Text::FormBuilder->parse_text('');
22isa_ok($p, 'Text::FormBuilder', 'new parser (from parse_text as class method)');
23
24$p = Text::FormBuilder->parse(\'');
25isa_ok($p, 'Text::FormBuilder', 'new parser (from parse as class method)');
26
27
28my $simple = <<END;
29name
30email
31phone
32END
33
34my $form = $p->parse(\$simple)->form;
35# we should have three fields
36is(keys %{ $form->fields }, 3, 'correct number of fields');
37
38## my $p2 = Text::FormBuilder->parse_array([qw(code title semester instructor)]);
39## is(keys %{ $p2->form->fields }, 4, 'correct number of fields from parse_array');
40## $p2->write;
Note: See TracBrowser for help on using the repository browser.