Gin/Error.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 29 CC 1 SCAR 6.9
CC
1
Cov
0%
new_code
2.0
codes
2.0
BEGIN
2.0
CRAP 2.0
1 package Game::Gin::Error;
2  
3 use strict;
4 use warnings;
5  
6 use Object::Proto::Sugar -types;
7  
8 our $VERSION = '0.04';
9  
10 my %MESSAGE = (
11 hand_over => 'the hand is over',
12 not_your_turn => 'it is not your turn',
13 not_legal => 'the rules do not offer that',
14 not_held => 'that card is not in your hand',
15 just_taken => 'you may not discard the card you have just taken',
16 cannot_knock => 'your deadwood is above the knock threshold',
17 not_big_gin => 'that hand is not big gin',
18 no_seed => 'a hand needs a seed',
19 );
20  
21 has code => (is => 'ro', isa => Str);
22 has message => (is => 'ro', isa => Str);
23  
24 sub new_code {
25 my ($class, $code) = @_;
26 return $class->new(
27 code => $code,
28 message => $MESSAGE{$code} // $code,
29 );
30 }
31  
32 sub codes { return sort keys %MESSAGE }
33  
34 1;
35  
36 __END__