Beginning of dzilization
[gitmo/Moose.git] / t / 100_bugs / 011_DEMOLISH_eats_exceptions.t
index 31edb46..9179597 100644 (file)
@@ -4,15 +4,16 @@ use strict;
 use warnings;
 use FindBin;
 
-use Test::More tests => 144;
-use Test::Exception;
+use Test::More;
 
 use Moose::Util::TypeConstraints;
 
 subtype 'FilePath'
     => as 'Str'
-    => where { $_ =~ m#^(/[a-zA-Z0-9_.-]+)+/?$#
-                || $_ =~ m#^([c-zC-Z]:/[a-zA-Z0-9_.-]+)# };
+    # This used to try to _really_ check for a valid Unix or Windows
+    # path, but the regex wasn't quite right, and all we care about
+    # for the tests is that it rejects '/'
+    => where { $_ ne '/' };
 {
     package Baz;
     use Moose;
@@ -113,32 +114,32 @@ sub check_em {
          ::is( $obj, undef, "... the object is undef" );
      }
      {
-         local $@;        
-         my $obj = eval { $pkg->new ( undef ); };
+         local $@;
+         my $obj = eval { $pkg->new ( notanattr => 1 ); };
          ::like( $@, qr/is required/, "... $pkg undef" );
          ::is( $obj, undef, "... the object is undef" );
      }
 
      {
-         local $@;        
+         local $@;
          my $obj = eval { $pkg->new ( %param ); };
          ::like( $@, qr/is required/, "... $pkg undef param" );
          ::is( $obj, undef, "... the object is undef" );
      }
      {
-         local $@;        
+         local $@;
          my $obj = eval { $pkg->new ( path => '/' ); };
          ::like( $@, qr/does not pass the type constraint/, "... $pkg root path forbidden" );
          ::is( $obj, undef, "... the object is undef" );
      }
      {
-         local $@;        
+         local $@;
          my $obj = eval { $pkg->new ( path => '/this_path/does/not_exist' ); };
          ::like( $@, qr/does not exist/, "... $pkg non existing path" );
          ::is( $obj, undef, "... the object is undef" );
      }
      {
-         local $@;        
+         local $@;
          my $obj = eval { $pkg->new ( path => $FindBin::Bin ); };
          ::is( $@, '', "... $pkg no error" );
          ::isa_ok( $obj, $pkg );
@@ -147,5 +148,4 @@ sub check_em {
      }
 }
 
-1;
-
+done_testing;