Group
Extension

Matches 58

Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/HashRef.t ( view source; MetaCPAN )
HashRef doesn't have a coercion");
ok(HashRef->is_parameterizable, "HashRef is parameterizable");
isnt(HashRef->type_default, undef, "HashRef has a type_default");
is_deeply(HashRef->type_default->(),
t have a coercion");
ok(!$HashOfInts->is_parameterizable, "\$HashOfInts is not parameterizable");
isnt($HashOfInts->type_default, undef, "\$HashOfInts has a type_default");
is_deeply($HashOfInts->type
ged" );
};

do {
	my $orig    = { foo => 42.1 };
	my $coerced = $HashOfRounded->coerce($orig);
	
	isnt( refaddr($orig), refaddr($coerced), "coercion happened" );
	is($coerced->{foo}, 42, "... and data
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/30-external/Mouse/basic.t ( view source; MetaCPAN )
hat should pass their type constraint",
);

isnt(
	exception { "Local::Class"->new(small => 100) },
	undef,
	"direct violation of type constraint",
);

isnt(
	exception { "Local::Class"->new(small => 
on of parent type constraint",
);

isnt(
	exception { "Local::Class"->new(small => "five point five") },
	undef,
	"violation of grandparent type constraint",
);

isnt(
	exception { "Local::Class"->new
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/30-external/Mouse/coercion.t ( view source; MetaCPAN )
	);
	};
	isnt($e, undef, "'big' attribute throws when it cannot coerce in constructor - $suffix");

	$e = exception {
		$o = "Local::Class"->new(
			small => {},
			big   => [],
		);
	};
	isnt($e, und
	
	$e = exception { $o->big({}) };
	isnt($e, undef, "'big' attribute throws when it cannot coerce in accessor - $suffix");

	$e = exception { $o->small({}) };
	isnt($e, undef, "'small' attribute throw
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/30-external/Moo/basic.t ( view source; MetaCPAN )
hat should pass their type constraint",
);

isnt(
	exception { "Local::Class"->new(small => 100) },
	undef,
	"direct violation of type constraint",
);

isnt(
	exception { "Local::Class"->new(small => 
on of parent type constraint",
);

isnt(
	exception { "Local::Class"->new(small => "five point five") },
	undef,
	"violation of grandparent type constraint",
);

isnt(
	exception { "Local::Class"->new
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/30-external/Return-Type/basic.t ( view source; MetaCPAN )

		);
		
		isnt(
			exception { scalar(foo(4.2)) },
			undef,
		);
		
		done_testing;
	};
	
	subtest "list context" => sub
	{
		is_deeply(
			[ foo(4, 2) ],
			[     4, 2  ],
		);
		
		isnt(
			except
),
			4,
		);
		
		TODO: {
			local $TODO = 'this seems to fail: error in Return::Type??';
			
			isnt(
				exception { scalar(bar(xxx => 1, 2)) },
				undef,
			);
		}
		
		done_testing;
	};
	
	subte
 => sub
	{
		is_deeply(
			{ bar(xxx => 1, yyy => 2) },
			{     xxx => 1, yyy => 2  },
		);
		
		isnt(
			exception { [ bar(xxx => 1, 2) ] },
			undef,
		);
		
		done_testing;
	};
	
	done_testing;
};
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/ArrayRef.t ( view source; MetaCPAN )
ayRef doesn't have a coercion");
ok(ArrayRef->is_parameterizable, "ArrayRef is parameterizable");
isnt(ArrayRef->type_default, undef, "ArrayRef has a type_default");
is_deeply(ArrayRef->type_default->
have a coercion");
ok(!$ArrayOfInts->is_parameterizable, "\$ArrayOfInts is not parameterizable");
isnt($ArrayOfInts->type_default, undef, "\$ArrayOfInts has a type_default");
is_deeply($ArrayOfInts->t
unchanged" );
};

do {
	my $orig    = [ 42.1 ];
	my $coerced = $ArrayOfRounded->coerce($orig);
	
	isnt( refaddr($orig), refaddr($coerced), "coercion happened" );
	is($coerced->[0], 42, "... and data l
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/Map.t ( view source; MetaCPAN )
_coercion, "Map doesn't have a coercion");
ok(Map->is_parameterizable, "Map is parameterizable");
isnt(Map->type_default, undef, "Map has a type_default");
is_deeply(Map->type_default->(), {}, "Map ty
 coercion");
ok(!$MapWithIntKeys->is_parameterizable, "\$MapWithIntKeys is not parameterizable");
isnt($MapWithIntKeys->type_default, undef, "\$MapWithIntKeys has a type_default");
is_deeply($MapWithI
};

do {
	my $orig    = { 3.1 => 4.2 };
	my $coerced = $HashOfRounded->coerce($orig); # {3=>4}
	
	isnt( refaddr($orig), refaddr($coerced), "coercion happened" );
	is($coerced->{3}, 4, "... and data lo
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/30-external/Moops/basic.t ( view source; MetaCPAN )
);
is($foo->add(2), 42);
is($foo->num, 42);

isnt(
	exception { $foo->num("Hello") },
	undef,
);

isnt(
	exception { $foo->add("Hello") },
	undef,
);

isnt(
	exception { 'Foo'->new(num => "Hello") },
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/20-modules/Type-Tie/basic.t ( view source; MetaCPAN )
test "tied scalar" => sub
{
	tie my($int), Int;
	
	is(
		exception { $int = 42 },
		undef,
	);
	
	isnt(
		exception { $int = 4.2 },
		undef,
	);
	
	is($int, 42);
	
	done_testing;
};

subtest "tied arr
	
	is(
		exception {
			$ints[0] = 1;
			push @ints, 2;
			unshift @ints, 0;
		},
		undef,
	);
	
	isnt(
		exception { $ints[3] = 3.5 },
		undef,
	);
	
	is_deeply(
		\@ints,
		[ 0..2 ],
	);
	
	done_tes
e my(%ints), Int;
	
	is(
		exception {
			$ints{one} = 1;
			$ints{two} = 2;
		},
		undef,
	);
	
	isnt(
		exception { $ints{three} = 3.5 },
		undef,
	);
	
	is_deeply(
		\%ints,
		{ one => 1, two => 2 
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/Maybe.t ( view source; MetaCPAN )
ion, "Maybe doesn't have a coercion");
ok(Maybe->is_parameterizable, "Maybe is parameterizable");
isnt(Maybe->type_default, undef, "Maybe has a type_default");
is(Maybe->type_default->(), undef, "Mayb
e);

isnt($type->type_default, undef, "$type has a type_default, because Int does");
is($type->type_default->(), 0, "$type type_default is 0");

my $type2 = Maybe[ Types::Standard::Defined ];
isnt($ty
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/20-modules/Type-Params/clone.t ( view source; MetaCPAN )
=> 0' );
}

{
	my $check = compile( ArrayRef, { clone => 1 } );
	my ( $got ) = $check->( $arr );
	isnt( refaddr( $got ), refaddr( $arr ), 'compile with clone => 1' );
}

{
	my $check = compile_named( 
 $check = compile_named( xxx => ArrayRef, { clone => 1 } );
	my ( $got ) = $check->( xxx => $arr );
	isnt( refaddr( $got->{xxx} ), refaddr( $arr ), 'compile_named with clone => 1' );
}

done_testing;
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/Slurpy.t ( view source; MetaCPAN )
, "Slurpy doesn't have a coercion");
ok(Slurpy->is_parameterizable, "Slurpy is parameterizable");
isnt(Slurpy->type_default, undef, "Slurpy has a type_default");
is(Slurpy->type_default->(), undef, "S
, ucfirst("$label should fail $SlurpyCodeRef"));
	}
	else {
		fail("expected '$expect'?!");
	}
}

isnt(Slurpy->of( Types::Standard::HashRef )->type_default, undef, "Slurpy[HashRef] has a type_default"
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/30-external/Exporter-Tiny/basic.t ( view source; MetaCPAN )
n},
);

can_ok(main => "Any");

isnt(
	exception { "Types::Standard"->import("kghffubbtfui") },
	undef,
	q {Attempt to export a function which does not exist},
);

isnt(
	exception { "Types::Standard"
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/Optional.t ( view source; MetaCPAN )
ional doesn't have a coercion");
ok(Optional->is_parameterizable, "Optional is parameterizable");
isnt(Optional->type_default, undef, "Optional has a type_default");
is(Optional->type_default->(), und
hould_pass(0, $type);
should_pass(1, $type);
should_fail(1.1, $type);
should_fail(undef, $type);

isnt($type->type_default, undef, "$type has a type_default");
is($type->type_default->(), 0, "$type ty
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/Item.t ( view source; MetaCPAN )
on, "Item doesn't have a coercion");
ok(!Item->is_parameterizable, "Item isn't parameterizable");
isnt(Item->type_default, undef, "Item has a type_default");
is(Item->type_default->(), undef, "Item ty
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/CycleTuple.t ( view source; MetaCPAN )
e doesn't have a coercion");
ok(CycleTuple->is_parameterizable, "CycleTuple is parameterizable");
isnt(CycleTuple->type_default, undef, "CycleTuple has a type_default");
is_deeply(CycleTuple->type_def
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/Tuple.t ( view source; MetaCPAN )
ion, "Tuple doesn't have a coercion");
ok(Tuple->is_parameterizable, "Tuple is parameterizable");
isnt(Tuple->type_default, undef, "Tuple has a type_default");
is_deeply(Tuple->type_default->(), [], "
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/CodeLike.t ( view source; MetaCPAN )
e doesn't have a coercion");
ok(!CodeLike->is_parameterizable, "CodeLike isn't parameterizable");
isnt(CodeLike->type_default, undef, "CodeLike has a type_default");
is(scalar CodeLike->type_default->
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/Dict.t ( view source; MetaCPAN )
ercion, "Dict doesn't have a coercion");
ok(Dict->is_parameterizable, "Dict is parameterizable");
isnt(Dict->type_default, undef, "Dict has a type_default");
is_deeply(Dict->type_default->(), {}, "Dic
Type-Tiny ( T/TO/TOBYINK/Type-Tiny-2.004000.tar.gz, TOBYINK, 2023; MetaCPAN )
Type-Tiny/t/21-types/TypeTiny.t ( view source; MetaCPAN )
 "TypeTiny has a coercion");
ok(!TypeTiny->is_parameterizable, "TypeTiny isn't parameterizable");
isnt(TypeTiny->type_default, undef, "TypeTiny has a type_default");
is(TypeTiny->type_default->(), do 

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.