From abcf38defd36cf7e25ac4b4d7e07f01d0bbd3cb1 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 15 Oct 2012 16:57:51 -0500 Subject: missing hashref/arrayref errors still need formatting also, they weren't being generated at all if the data was missing altogether --- t/complex.t | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 't/complex.t') diff --git a/t/complex.t b/t/complex.t index 04dbe60..a11ecd0 100644 --- a/t/complex.t +++ b/t/complex.t @@ -185,6 +185,33 @@ doctype 'Location' => { ); ok(!$errors->has_extra_data, "no extra data"); } + + { + my $errors = $location->validate({ + id => '14931-FL-53', + name => 'My House', + contact => { + phone => '867-5309', + support => 'anelson@cpan.org', + web => URI->new('https://metacpan.org/author/ANELSON'), + email => 'anelson@cpan.org', + }, + i18n => { + default_currency => 'USD', + default_locale => 'en', + available_currencies => [ 'CAD', 'EUR' ], + available_locales => [ 'en' ] + } + }); + is_deeply( + $errors->errors, + { + location => "invalid value undef for 'location'", + }, + "got the right errors" + ); + ok(!$errors->has_extra_data, "no extra data"); + } } done_testing; -- cgit v1.2.3