Last active
July 10, 2020 11:41
-
-
Save j1n3l0/2ab08538c480803be00253f4521607be to your computer and use it in GitHub Desktop.
A simple type library demonstrating Dict with optional arguments
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
package Foo; | |
use Type::Library -base; | |
use Type::Utils qw( as declare ); | |
use Types::Standard qw( Dict HashRef Int slurpy ); | |
declare Params, as Dict[ id => Int, slurpy HashRef ]; | |
1; |
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 Foo qw( is_Params ); | |
ok( is_Params({ id => 1 }), 'should be a valid Params' ); | |
ok( is_Params({ id => 1, code => 2 }), 'should be a valid Params' ); | |
done_testing(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment