Last active
November 21, 2018 16:05
-
-
Save j1n3l0/921a07a004c034cb7b7266003abcff9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Test2::V0; | |
use PerlX::Maybe qw< :all >; | |
subtest 'provided_deref' => sub { | |
my $object = mock {} => ( | |
add => [ | |
count => sub { 1 }, | |
interval => sub { 1 }, | |
update => sub { | |
+{ | |
provided_deref $_[0]->count, { | |
count => $_[0]->count, | |
interval => $_[0]->interval, | |
}, | |
}; | |
}, | |
], | |
); | |
like( | |
$object->update, | |
{ | |
count => qr/^[0-9]+$/, | |
interval => qr/^[0-9]+$/, | |
}, | |
'should dereference based on a condition', | |
); | |
}; | |
done_testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment