updated stuff
[gitmo/Moose.git] / t / type_constraints / inlining.t
index b8b4449..d096e69 100644 (file)
@@ -24,19 +24,19 @@ my $not_inlinable = find_type_constraint('NotInlinable');
 
 {
     ok(
-        $inlinable->has_inlined_type_constraint,
-        'Inlinable returns true for has_inlined_type_constraint'
+        $inlinable->can_be_inlined,
+        'Inlinable returns true for can_be_inlined'
     );
 
     is(
         $inlinable->_inline_check('$foo'),
-        'defined $foo && ! ref $foo && $foo !~ /Q/',
+        '( do { defined $foo && ! ref $foo && $foo !~ /Q/ } )',
         'got expected inline code for Inlinable constraint'
     );
 
     ok(
-        !$not_inlinable->has_inlined_type_constraint,
-        'NotInlinable returns false for has_inlined_type_constraint'
+        !$not_inlinable->can_be_inlined,
+        'NotInlinable returns false for can_be_inlined'
     );
 
     like(
@@ -51,13 +51,13 @@ my $not_inlinable = find_type_constraint('NotInlinable');
         'ArrayRef[Inlinable]');
 
     ok(
-        $aofi->has_inlined_type_constraint,
-        'ArrayRef[Inlinable] returns true for has_inlined_type_constraint'
+        $aofi->can_be_inlined,
+        'ArrayRef[Inlinable] returns true for can_be_inlined'
     );
 
     is(
         $aofi->_inline_check('$foo'),
-        q{ref($foo) eq "ARRAY" && &List::MoreUtils::all(sub { defined $_ && ! ref $_ && $_ !~ /Q/ }, @{$foo})},
+        q{( do { do {my $check = $foo;ref($check) eq "ARRAY" && &List::MoreUtils::all(sub { ( do { defined $_ && ! ref $_ && $_ !~ /Q/ } ) }, @{$check})} } )},
         'got expected inline code for ArrayRef[Inlinable] constraint'
     );
 
@@ -65,8 +65,8 @@ my $not_inlinable = find_type_constraint('NotInlinable');
         'ArrayRef[NotInlinable]');
 
     ok(
-        !$aofni->has_inlined_type_constraint,
-        'ArrayRef[NotInlinable] returns false for has_inlined_type_constraint'
+        !$aofni->can_be_inlined,
+        'ArrayRef[NotInlinable] returns false for can_be_inlined'
     );
 }
 
@@ -80,13 +80,13 @@ subtype 'ArrayOfNotInlinable',
         'ArrayOfInlinable');
 
     ok(
-        $aofi->has_inlined_type_constraint,
-        'ArrayOfInlinable returns true for has_inlined_type_constraint'
+        $aofi->can_be_inlined,
+        'ArrayOfInlinable returns true for can_be_inlined'
     );
 
     is(
         $aofi->_inline_check('$foo'),
-        q{ref($foo) eq "ARRAY" && &List::MoreUtils::all(sub { defined $_ && ! ref $_ && $_ !~ /Q/ }, @{$foo})},
+        q{( do { do {my $check = $foo;ref($check) eq "ARRAY" && &List::MoreUtils::all(sub { ( do { defined $_ && ! ref $_ && $_ !~ /Q/ } ) }, @{$check})} } )},
         'got expected inline code for ArrayOfInlinable constraint'
     );
 
@@ -94,8 +94,8 @@ subtype 'ArrayOfNotInlinable',
         'ArrayOfNotInlinable');
 
     ok(
-        !$aofni->has_inlined_type_constraint,
-        'ArrayOfNotInlinable returns false for has_inlined_type_constraint'
+        !$aofni->can_be_inlined,
+        'ArrayOfNotInlinable returns false for can_be_inlined'
     );
 }
 
@@ -104,13 +104,13 @@ subtype 'ArrayOfNotInlinable',
         'HashRef[ArrayRef[Inlinable]]');
 
     ok(
-        $hoaofi->has_inlined_type_constraint,
-        'HashRef[ArrayRef[Inlinable]] returns true for has_inlined_type_constraint'
+        $hoaofi->can_be_inlined,
+        'HashRef[ArrayRef[Inlinable]] returns true for can_be_inlined'
     );
 
     is(
         $hoaofi->_inline_check('$foo'),
-        q{ref($foo) eq "HASH" && &List::MoreUtils::all(sub { ref($_) eq "ARRAY" && &List::MoreUtils::all(sub { defined $_ && ! ref $_ && $_ !~ /Q/ }, @{$_}) }, values %{$foo})},
+        q{( do { do {my $check = $foo;ref($check) eq "HASH" && &List::MoreUtils::all(sub { ( do { do {my $check = $_;ref($check) eq "ARRAY" && &List::MoreUtils::all(sub { ( do { defined $_ && ! ref $_ && $_ !~ /Q/ } ) }, @{$check})} } ) }, values %{$check})} } )},
         'got expected inline code for HashRef[ArrayRef[Inlinable]] constraint'
     );
 
@@ -118,8 +118,8 @@ subtype 'ArrayOfNotInlinable',
         'HashRef[ArrayRef[NotInlinable]]');
 
     ok(
-        !$hoaofni->has_inlined_type_constraint,
-        'HashRef[ArrayRef[NotInlinable]] returns false for has_inlined_type_constraint'
+        !$hoaofni->can_be_inlined,
+        'HashRef[ArrayRef[NotInlinable]] returns false for can_be_inlined'
     );
 }
 
@@ -128,13 +128,13 @@ subtype 'ArrayOfNotInlinable',
         'Inlinable | Object');
 
     ok(
-        $iunion->has_inlined_type_constraint,
-        'Inlinable | Object returns true for has_inlined_type_constraint'
+        $iunion->can_be_inlined,
+        'Inlinable | Object returns true for can_be_inlined'
     );
 
     is(
         $iunion->_inline_check('$foo'),
-        '(defined $foo && ! ref $foo && $foo !~ /Q/) || (Scalar::Util::blessed($foo))',
+        '((( do { defined $foo && ! ref $foo && $foo !~ /Q/ } )) || (( do { Scalar::Util::blessed($foo) } )))',
         'got expected inline code for Inlinable | Object constraint'
     );
 
@@ -142,8 +142,8 @@ subtype 'ArrayOfNotInlinable',
         'NotInlinable | Object');
 
     ok(
-        !$niunion->has_inlined_type_constraint,
-        'NotInlinable | Object returns false for has_inlined_type_constraint'
+        !$niunion->can_be_inlined,
+        'NotInlinable | Object returns false for can_be_inlined'
     );
 }
 
@@ -152,13 +152,13 @@ subtype 'ArrayOfNotInlinable',
         'Object | Inlinable');
 
     ok(
-        $iunion->has_inlined_type_constraint,
-        'Object | Inlinable returns true for has_inlined_type_constraint'
+        $iunion->can_be_inlined,
+        'Object | Inlinable returns true for can_be_inlined'
     );
 
     is(
         $iunion->_inline_check('$foo'),
-        '(Scalar::Util::blessed($foo)) || (defined $foo && ! ref $foo && $foo !~ /Q/)',
+        '((( do { Scalar::Util::blessed($foo) } )) || (( do { defined $foo && ! ref $foo && $foo !~ /Q/ } )))',
         'got expected inline code for Object | Inlinable constraint'
     );
 
@@ -166,8 +166,8 @@ subtype 'ArrayOfNotInlinable',
         'Object | NotInlinable');
 
     ok(
-        !$niunion->has_inlined_type_constraint,
-        'Object | NotInlinable returns false for has_inlined_type_constraint'
+        !$niunion->can_be_inlined,
+        'Object | NotInlinable returns false for can_be_inlined'
     );
 }
 
@@ -176,13 +176,13 @@ subtype 'ArrayOfNotInlinable',
         'Object | Inlinable | CodeRef');
 
     ok(
-        $iunion->has_inlined_type_constraint,
-        'Object | Inlinable | CodeRef returns true for has_inlined_type_constraint'
+        $iunion->can_be_inlined,
+        'Object | Inlinable | CodeRef returns true for can_be_inlined'
     );
 
     is(
         $iunion->_inline_check('$foo'),
-        q{(Scalar::Util::blessed($foo)) || (defined $foo && ! ref $foo && $foo !~ /Q/) || (ref($foo) eq "CODE")},
+        q{((( do { Scalar::Util::blessed($foo) } )) || (( do { defined $foo && ! ref $foo && $foo !~ /Q/ } )) || (( do { ref($foo) eq "CODE" } )))},
         'got expected inline code for Object | Inlinable | CodeRef constraint'
     );
 
@@ -190,8 +190,8 @@ subtype 'ArrayOfNotInlinable',
         'Object | NotInlinable | CodeRef');
 
     ok(
-        !$niunion->has_inlined_type_constraint,
-        'Object | NotInlinable | CodeRef returns false for has_inlined_type_constraint'
+        !$niunion->can_be_inlined,
+        'Object | NotInlinable | CodeRef returns false for can_be_inlined'
     );
 }