Skip to content

Instantly share code, notes, and snippets.

@aereal
Created April 19, 2017 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aereal/70ccc61f555d4bb1d59e6d46a11867fb to your computer and use it in GitHub Desktop.
Save aereal/70ccc61f555d4bb1d59e6d46a11867fb to your computer and use it in GitHub Desktop.
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