Changeset 42 in text-formbuilder for trunk/t/Text-FormBuilder.t


Ignore:
Timestamp:
12/09/04 11:33:17 (19 years ago)
Author:
peter
Message:

added a create_form exported method to "do the right thing" in simple cases
added parse_array method to parse an array of lines making up a formspec
some internal cleanup of the lines structure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/t/Text-FormBuilder.t

    r19 r42  
    66# change 'tests => 1' to 'tests => last_test_to_print'; 
    77 
    8 use Test::More tests => 6; 
     8use Test::More qw(no_plan); #tests => 6; 
    99BEGIN { use_ok('Text::FormBuilder'); }; 
    1010 
     
    2525isa_ok($p, 'Text::FormBuilder', 'new parser (from parse as class method)'); 
    2626 
     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 
     38my $p2 = Text::FormBuilder->parse_array([qw(code title semester instructor)]); 
     39is(keys %{ $p2->form->fields }, 4, 'correct number of fields from parse_array'); 
     40$p2->write; 
Note: See TracChangeset for help on using the changeset viewer.