added eval carrols bug with sub exporter 0.08
John Napiorkowski [Tue, 11 Nov 2008 23:20:28 +0000 (23:20 +0000)]
t/14_compatibility-sub-exporter.t [new file with mode: 0644]
t/lib/SubExporterCompatibility.pm [new file with mode: 0644]

diff --git a/t/14_compatibility-sub-exporter.t b/t/14_compatibility-sub-exporter.t
new file mode 100644 (file)
index 0000000..b2d2fb3
--- /dev/null
@@ -0,0 +1,20 @@
+BEGIN {
+       use strict;
+       use warnings;
+       use Test::More;
+    use Test::Exception;
+    use FindBin;
+    use lib "$FindBin::Bin/lib";   
+    
+    eval "use Sub::Exporter";
+    plan $@
+        ? ( skip_all => "Tests require Sub::Exporter" )
+        : ( tests => 3 );
+}
+
+use SubExporterCompatibility qw(MyStr);
+
+ok MyStr->check('aaa'), "Correctly passed";
+ok !MyStr->check([1]), "Correctly fails";
+ok something(), "Found the something method";
+
diff --git a/t/lib/SubExporterCompatibility.pm b/t/lib/SubExporterCompatibility.pm
new file mode 100644 (file)
index 0000000..9456929
--- /dev/null
@@ -0,0 +1,14 @@
+package SubExporterCompatibility; {
+    
+    use MooseX::Types::Moose qw(Str);
+    use MooseX::Types -declare => [qw(MyStr)];
+    use Sub::Exporter -setup => { exports => [ qw(something) ] };
+    
+    subtype MyStr,
+     as Str;
+     
+    sub something {
+        return 1;
+    }    
+    
+} 1;