Test::Deep::Matcher - Type check matchers for Test::Deep
use Test::More;
use Test::Deep;
use Test::Deep::Matcher;
my $got = +{
foo => 'string',
bar => 100,
baz => [ 1, 2, 3 ],
quux => { foo => 'bar' },
};
cmp_deeply($got, +{
foo => is_string,
bar => is_integer,
baz => is_array_ref,
quux => is_hash_ref,
});
done_testing;
Test::Deep::Matcher is a collection of Test::Deep type check matchers.
- is_scalar_ref
-
Checks the value type is SCALAR reference.
- is_array_ref
-
Checks the value type is ARRAY reference.
- is_hash_ref
-
Checks the value type is HASH reference.
- is_code_ref
-
Checks the value type is CODE reference.
- is_glob_ref
-
Checks the value type is GLOB reference.
- is_value
-
Checks the value is primitive, is not undef.
- is_string
-
Checks the value is string, has length.
- is_number
-
Checks the value is number.
- is_integer
-
Checks the value is integer, is also number.
NAKAGAWA Masaki <[email protected]>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.