Guest User

Untitled

a guest
Jul 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. my %validation = $dumper->build_hoh;
  2. is_deeply({test=> {field_name =>'test_field', validators => { regex => qr/^[0-9a-z]*$/ } } }, \%validation);
  3.  
  4. sub build_hoh {
  5. my $self = shift;
  6. my %params;
  7. my $form = $self->form;
  8.  
  9. for my $fieldname ( $form->fieldnames ) {
  10. my $name = $form->name;
  11. my $field = $form->field($fieldname);
  12.  
  13. $params{
  14. $name => {
  15. field_name => $fieldname,
  16. validators => { $field->validation->{$fieldname} }
  17. },
  18. }
  19.  
  20. }
  21.  
  22. return %params;
  23. }
  24.  
  25. squishface:Form-Sensible dhoss$ prove -l t/dump_basic.t
  26. t/dump_basic.t .. Useless use of hash element in void context at /Users/dhoss/web-devel/Form-Sensible/lib/Form/Sensible/Renderer/TestDump.pm line 21.
  27. Odd number of elements in anonymous hash at /Users/dhoss/web-devel/Form-Sensible/lib/Form/Sensible/Renderer/TestDump.pm line 21.
  28. Use of uninitialized value in anonymous hash ({}) at /Users/dhoss/web-devel/Form-Sensible/lib/Form/Sensible/Renderer/TestDump.pm line 21.
  29. t/dump_basic.t .. 1/?
  30. # Failed test at t/dump_basic.t line 13.
  31. # Structures begin differing at:
  32. # $got->{test} = HASH(0x100b9a370)
  33. # $expected->{test} = Does not exist
  34. # Looks like you failed 1 test of 1.
  35. t/dump_basic.t .. Dubious, test returned 1 (wstat 256, 0x100)
  36. Failed 1/1 subtests
  37.  
  38. Test Summary Report
  39. -------------------
  40. t/dump_basic.t (Wstat: 256 Tests: 1 Failed: 1)
  41. Failed test: 1
  42. Non-zero exit status: 1
  43. Files=1, Tests=1, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.27 cusr 0.02 csys = 0.32 CPU)
  44. Result: FAIL
Add Comment
Please, Sign In to add comment