Document and test that deleting multiple keys from the hash with the delete trait...
[gitmo/Moose.git] / t / 200_examples / 001_example.t
index 33f9058..d7dd836 100644 (file)
@@ -3,12 +3,10 @@
 use strict;
 use warnings;
 
-use Test::More tests => 21;
+use Test::More tests => 20;
 use Test::Exception;
 
-BEGIN {
-    use_ok('Moose');           
-}
+
 
 ## Roles
 
@@ -22,16 +20,16 @@ BEGIN {
         my $c = shift;
         my ($self, $field) = @_;
         return undef if $c->($self, $self->validation_value($field));
-        return $self->error_message;        
+        return $self->error_message;
     };
-    
+
     sub validation_value {
         my ($self, $field) = @_;
         return $field;
     }
-    
+
     sub error_message { confess "Abstract method!" }
-    
+
     package Constraint::OnLength;
     use Moose::Role;
 
@@ -44,11 +42,11 @@ BEGIN {
     override 'error_message' => sub {
         my $self = shift;
         return super() . ' ' . $self->units;
-    };    
+    };
 
 }
 
-## Classes 
+## Classes
 
 {
     package Constraint::AtLeast;
@@ -80,12 +78,12 @@ BEGIN {
 
     extends 'Constraint::NoMoreThan';
        with 'Constraint::OnLength';
-       
+
     package Constraint::LengthAtLeast;
     use Moose;
-    
+
     extends 'Constraint::AtLeast';
-       with 'Constraint::OnLength';       
+       with 'Constraint::OnLength';
 }
 
 my $no_more_than_10 = Constraint::NoMoreThan->new(value => 10);
@@ -114,8 +112,8 @@ ok($no_more_than_10_chars->does('Constraint'), '... Constraint::LengthNoMoreThan
 ok($no_more_than_10_chars->does('Constraint::OnLength'), '... Constraint::LengthNoMoreThan does Constraint::OnLength');
 
 ok(!defined($no_more_than_10_chars->validate('foo')), '... validated correctly');
-is($no_more_than_10_chars->validate('foooooooooo'), 
-    'must be no more than 10 chars', 
+is($no_more_than_10_chars->validate('foooooooooo'),
+    'must be no more than 10 chars',
     '... validation failed correctly');
 
 my $at_least_10_chars = Constraint::LengthAtLeast->new(value => 10, units => 'chars');