Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created June 18, 2014 03:26
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 hitode909/159fabc2cdc08209474c to your computer and use it in GitHub Desktop.
Save hitode909/159fabc2cdc08209474c to your computer and use it in GitHub Desktop.
smartmatch最悪
use experimental 'smartmatch';
use Test::More tests => 5;
sub in_tripartite_pact {
my ($country) = @_;
return $country ~~ ['Japan', 'Germany', 'Italy'];
}
ok in_tripartite_pact('Japan'), 'Japan signed the pact.';
ok in_tripartite_pact('Germany'), 'Germany signed the pact.';
ok in_tripartite_pact('Italy'), 'Italy signed the pact.';
ok ! in_tripartite_pact('America'), "America didn't signed the pact.";
ok in_tripartite_pact(['Japan', 'Germany', 'Italy']), '最悪';
# % prove -v a.pl
# a.pl ..
# 1..5
# ok 1 - Japan signed the pact.
# ok 2 - Germany signed the pact.
# ok 3 - Italy signed the pact.
# ok 4 - America didn't signed the pact.
# ok 5 - 最悪
# ok
# All tests successful.
# Files=1, Tests=5, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.02 cusr 0.00 csys = 0.06 CPU)
# Result: PASS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment