Created
April 19, 2017 04:02
-
-
Save aereal/70ccc61f555d4bb1d59e6d46a11867fb 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 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