Cheat sheet
- Test2::Tools::Compare
- is like isnt unlike
- match mismatch validator
- hash array bag object meta number float rounded within string subset bool
- in_set not_in_set check_set
- item field call call_list call_hash prop check all_items all_keys all_vals all_values
- etc end filter_items
- T F D DF E DNE FDNE U L
- event fail_events
- exact_ref
=head2 SYNOPSIS
use Test2::V0;
# Match regex in a hash
like( $some_hash, hash { # <-- Must use `like` keyword to make regex below work
field 'message' => qr/Caught exception/; # <-- Note `field` keyword and trailing semicolon. Quotes around key optional
end(); # <-- Enforce that no other keys are present, optional
}, 'Logged error correctly'); # <-- Test description and parentheses () are optional
is(
{
a => 1,
b => 'foo',
},
{
a => D(), # value is Defined
b => E(), # value Exists
c => DNE(), # key/value Does Not Exist
},
'I can haz Test2?'
);
use Test::More;
TODO: {
local $TODO = 'Still working on this';
ok(0, "work in progress");
}
use Test2::Tools::Tiny qw/todo/;
todo 'Still working on this' => sub {
ok(0, "failing test gonna fail");
}; # <--- remember the semicolon!
See t/regression/todo_and_facets.t