[Catalyst-commits] r7856 - trunk/CatalystX-Imports/t

rafl at dev.catalyst.perl.org rafl at dev.catalyst.perl.org
Thu May 29 14:01:01 BST 2008


Author: rafl
Date: 2008-05-29 14:01:00 +0100 (Thu, 29 May 2008)
New Revision: 7856

Added:
   trunk/CatalystX-Imports/t/30-exceptions.t
Log:
Add some tests for various exceptions.


Added: trunk/CatalystX-Imports/t/30-exceptions.t
===================================================================
--- trunk/CatalystX-Imports/t/30-exceptions.t	                        (rev 0)
+++ trunk/CatalystX-Imports/t/30-exceptions.t	2008-05-29 13:01:00 UTC (rev 7856)
@@ -0,0 +1,29 @@
+#!perl
+use warnings;
+use strict;
+
+use Test::More;
+
+eval 'use Test::Exception';
+plan skip_all => 'Test::Exception required' if $@;
+plan tests => 4;
+
+sub _action_cache { return [] }
+
+use CatalystX::Imports;
+
+lives_ok(sub {
+    CatalystX::Imports->export_into('Foo', Vars => {});
+}, 'export_into works with an even number of arguments');
+
+throws_ok(sub {
+    CatalystX::Imports->export_into('Foo', 'Vars');
+}, qr{expects a key/value list}, 'export_into fails with an odd number of arguments');
+
+throws_ok(sub {
+    CatalystX::Imports->export_into('Foo', Vars => []);
+}, qr/1 or a hash reference expected/, 'Vars export_into fails with something not 1 or hashref (arrayref)');
+
+throws_ok(sub {
+    CatalystX::Imports->export_into('Foo', Vars => 0);
+}, qr/1 or a hash reference expected/, 'Vars export_into fails with somethong not 1 or hashref (0)');




More information about the Catalyst-commits mailing list