run all code through perltidy
[gitmo/MooseX-StrictConstructor.git] / t / basic.t
index 24f62ce..57ab8ad 100644 (file)
--- a/t/basic.t
+++ b/t/basic.t
@@ -3,8 +3,8 @@ use warnings;
 
 use Test::More tests => 15;
 
-
 {
+
     package Standard;
 
     use Moose;
@@ -13,6 +13,7 @@ use Test::More tests => 15;
 }
 
 {
+
     package Stricter;
 
     use Moose;
@@ -22,6 +23,7 @@ use Test::More tests => 15;
 }
 
 {
+
     package Subclass;
 
     use Moose;
@@ -33,6 +35,7 @@ use Test::More tests => 15;
 }
 
 {
+
     package Tricky;
 
     use Moose;
@@ -40,8 +43,7 @@ use Test::More tests => 15;
 
     has 'thing' => ( is => 'rw' );
 
-    sub BUILD
-    {
+    sub BUILD {
         my $self   = shift;
         my $params = shift;
 
@@ -50,6 +52,7 @@ use Test::More tests => 15;
 }
 
 {
+
     package InitArg;
 
     use Moose;
@@ -60,6 +63,7 @@ use Test::More tests => 15;
 }
 
 {
+
     package ImmutableInitArg;
 
     use Moose;
@@ -73,6 +77,7 @@ use Test::More tests => 15;
 }
 
 {
+
     package Immutable;
 
     use Moose;
@@ -85,6 +90,7 @@ use Test::More tests => 15;
 }
 
 {
+
     package ImmutableTricky;
 
     use Moose;
@@ -92,8 +98,7 @@ use Test::More tests => 15;
 
     has 'thing' => ( is => 'rw' );
 
-    sub BUILD
-    {
+    sub BUILD {
         my $self   = shift;
         my $params = shift;
 
@@ -104,57 +109,78 @@ use Test::More tests => 15;
     __PACKAGE__->meta()->make_immutable();
 }
 
-
 eval { Standard->new( thing => 1, bad => 99 ) };
 is( $@, '', 'standard Moose class ignores unknown params' );
 
 eval { Stricter->new( thing => 1, bad => 99 ) };
-like( $@, qr/unknown attribute.+: bad/, 'strict constructor blows up on unknown params' );
+like( $@, qr/unknown attribute.+: bad/,
+    'strict constructor blows up on unknown params' );
 
 eval { Subclass->new( thing => 1, size => 'large' ) };
 is( $@, '', 'subclass constructor handles known attributes correctly' );
 
 eval { Tricky->new( thing => 1, spy => 99 ) };
-is( $@, '', 'can work around strict constructor by deleting params in BUILD()' );
+is( $@, '',
+    'can work around strict constructor by deleting params in BUILD()' );
 
 eval { Tricky->new( thing => 1, agent => 99 ) };
-like( $@, qr/unknown attribute.+: agent/, 'Tricky still blows up on unknown params other than spy' );
+like( $@, qr/unknown attribute.+: agent/,
+    'Tricky still blows up on unknown params other than spy' );
 
 eval { Subclass->new( thing => 1, bad => 99 ) };
-like( $@, qr/unknown attribute.+: bad/, 'subclass constructor blows up on unknown params' );
+like( $@, qr/unknown attribute.+: bad/,
+    'subclass constructor blows up on unknown params' );
 
 eval { InitArg->new( thing => 1 ) };
-like( $@, qr/unknown attribute.+: thing/,
-      'InitArg blows up with attribute name' );
+like(
+    $@, qr/unknown attribute.+: thing/,
+    'InitArg blows up with attribute name'
+);
 
 eval { InitArg->new( size => 1 ) };
-like( $@, qr/unknown attribute.+: size/,
-      'InitArg blows up when given attribute with undef init_arg' );
+like(
+    $@, qr/unknown attribute.+: size/,
+    'InitArg blows up when given attribute with undef init_arg'
+);
 
 eval { InitArg->new( other => 1 ) };
-is( $@, '',
-    'InitArg works when given proper init_arg' );
+is(
+    $@, '',
+    'InitArg works when given proper init_arg'
+);
 
 eval { ImmutableInitArg->new( thing => 1 ) };
-like( $@, qr/unknown attribute.+: thing/,
-      'ImmutableInitArg blows up with attribute name' );
+like(
+    $@, qr/unknown attribute.+: thing/,
+    'ImmutableInitArg blows up with attribute name'
+);
 
 eval { ImmutableInitArg->new( size => 1 ) };
-like( $@, qr/unknown attribute.+: size/,
-      'ImmutableInitArg blows up when given attribute with undef init_arg' );
+like(
+    $@, qr/unknown attribute.+: size/,
+    'ImmutableInitArg blows up when given attribute with undef init_arg'
+);
 
 eval { ImmutableInitArg->new( other => 1 ) };
-is( $@, '',
-    'ImmutableInitArg works when given proper init_arg' );
+is(
+    $@, '',
+    'ImmutableInitArg works when given proper init_arg'
+);
 
 eval { Immutable->new( thing => 1, bad => 99 ) };
-like( $@, qr/unknown attribute.+: bad/,
-      'strict constructor in immutable class blows up on unknown params' );
+like(
+    $@, qr/unknown attribute.+: bad/,
+    'strict constructor in immutable class blows up on unknown params'
+);
 
 eval { ImmutableTricky->new( thing => 1, spy => 99 ) };
-is( $@, '',
-    'immutable class can work around strict constructor by deleting params in BUILD()' );
+is(
+    $@, '',
+    'immutable class can work around strict constructor by deleting params in BUILD()'
+);
 
 eval { ImmutableTricky->new( thing => 1, agent => 99 ) };
-like( $@, qr/unknown attribute.+: agent/,
-      'ImmutableTricky still blows up on unknown params other than spy' );
+like(
+    $@, qr/unknown attribute.+: agent/,
+    'ImmutableTricky still blows up on unknown params other than spy'
+);