Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
use strict;
use warnings;
use utf8;
BEGIN {
local $Return::Value::NO_CLUCK = 1;
require Return::Value;
}
use Test::Deep qw(cmp_deeply isa bool str methods);
use Test::More tests => 3;
sub create_failure {
return Return::Value::failure('oops');
}
{
my $value = Return::Value::success();
cmp_deeply $value, bool(1) & isa('Return::Value') & str('success') & methods(
['prop'] => +{},
);
};
{
my $value = Return::Value::success('ok', prop => { bad => [1, 2] });
cmp_deeply $value, bool(1) & isa('Return::Value') & str('ok') & methods(
['prop'] => +{
bad => [1, 2],
},
);
};
{
my $value = Return::Value::failure('oops');
cmp_deeply $value, bool(0) & isa('Return::Value') & str('oops') & methods(
['prop'] => +{},
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment