use strict;
use warnings;
-use Test::More tests => 297;
-use Test::Exception;
+use Test::More;
use Scalar::Util ();
use_ok('Moose::Util::TypeConstraints');
}
+my $STRING = "foo";
+
my $SCALAR_REF = \(my $var);
no warnings 'once'; # << I *hates* that warning ...
ok(defined Int(0), '... Int accepts anything which is an Int');
ok(defined Int(100), '... Int accepts anything which is an Int');
-ok(!defined Int(0.5), '... Int accepts anything which is not a Int');
-ok(!defined Int(100.01), '... Int accepts anything which is not a Int');
-ok(!defined Int(''), '... Int rejects anything which is not a Int');
-ok(!defined Int('Foo'), '... Int rejects anything which is not a Int');
-ok(!defined Int([]), '... Int rejects anything which is not a Int');
-ok(!defined Int({}), '... Int rejects anything which is not a Int');
-ok(!defined Int(sub {}), '... Int rejects anything which is not a Int');
-ok(!defined Int($SCALAR_REF), '... Int rejects anything which is not a Int');
-ok(!defined Int($GLOB), '... Int rejects anything which is not a Int');
-ok(!defined Int($GLOB_REF), '... Int rejects anything which is not a Int');
-ok(!defined Int($fh), '... Int rejects anything which is not a Int');
-ok(!defined Int(qr/../), '... Int rejects anything which is not a Int');
-ok(!defined Int(bless {}, 'Foo'), '... Int rejects anything which is not a Int');
-ok(!defined Int(undef), '... Int rejects anything which is not a Int');
+ok(!defined Int(0.5), '... Int accepts anything which is not an Int');
+ok(!defined Int(100.01), '... Int accepts anything which is not an Int');
+ok(!defined Int(''), '... Int rejects anything which is not an Int');
+ok(!defined Int('Foo'), '... Int rejects anything which is not an Int');
+ok(!defined Int([]), '... Int rejects anything which is not an Int');
+ok(!defined Int({}), '... Int rejects anything which is not an Int');
+ok(!defined Int(sub {}), '... Int rejects anything which is not an Int');
+ok(!defined Int($SCALAR_REF), '... Int rejects anything which is not an Int');
+ok(!defined Int($GLOB), '... Int rejects anything which is not an Int');
+ok(!defined Int($GLOB_REF), '... Int rejects anything which is not an Int');
+ok(!defined Int($fh), '... Int rejects anything which is not an Int');
+ok(!defined Int(qr/../), '... Int rejects anything which is not an Int');
+ok(!defined Int(bless {}, 'Foo'), '... Int rejects anything which is not an Int');
+ok(!defined Int(undef), '... Int rejects anything which is not an Int');
ok(defined Num(0), '... Num accepts anything which is an Num');
ok(defined Num(100), '... Num accepts anything which is an Num');
ok(defined Str(100), '... Str accepts anything which is a Str');
ok(defined Str(''), '... Str accepts anything which is a Str');
ok(defined Str('Foo'), '... Str accepts anything which is a Str');
+ok(defined Str(substr($STRING,0,1)),'... Str accepts anything which is a Str');
ok(!defined Str([]), '... Str rejects anything which is not a Str');
ok(!defined Str({}), '... Str rejects anything which is not a Str');
ok(!defined Str(sub {}), '... Str rejects anything which is not a Str');
ok(!defined ScalarRef({}), '... ScalarRef rejects anything which is not a ScalarRef');
ok(!defined ScalarRef(sub {}), '... ScalarRef rejects anything which is not a ScalarRef');
ok(defined ScalarRef($SCALAR_REF), '... ScalarRef accepts anything which is a ScalarRef');
+ok(defined ScalarRef(\$SCALAR_REF), '... ScalarRef accepts references to references');
ok(!defined ScalarRef($GLOB), '... ScalarRef rejects anything which is not a ScalarRef');
ok(!defined ScalarRef($GLOB_REF), '... ScalarRef rejects anything which is not a ScalarRef');
ok(!defined ScalarRef($fh), '... ScalarRef rejects anything which is not a ScalarRef');
ok(defined RoleName('Quux::Wibble::Role'), '... RoleName accepts anything which is a RoleName');
close($fh) || die "Could not close the filehandle $0 for test";
+
+done_testing;