1b39c5158Smillertuse strict; 2*6fb12b70Safresh1use warnings; 3b39c5158Smillertuse lib 't/lib'; 4b39c5158Smillertuse Test::More; 5b39c5158Smillertuse TAP::Formatter::Console; 6b39c5158Smillert 7b39c5158Smillertmy @schedule; 8b39c5158Smillert 9b39c5158SmillertBEGIN { 10b39c5158Smillert @schedule = ( 11b39c5158Smillert { method => '_range', 12b39c5158Smillert in => sub {qw/2 7 1 3 10 9/}, 13b39c5158Smillert out => sub {qw/1-3 7 9-10/}, 14b39c5158Smillert name => '... and it should return numbers as ranges' 15b39c5158Smillert }, 16b39c5158Smillert { method => '_balanced_range', 17b39c5158Smillert in => sub { 7, qw/2 7 1 3 10 9/ }, 18b39c5158Smillert out => sub { '1-3, 7', '9-10' }, 19b39c5158Smillert name => '... and it should return numbers as ranges' 20b39c5158Smillert }, 21b39c5158Smillert ); 22b39c5158Smillert 23b39c5158Smillert plan tests => @schedule * 3; 24b39c5158Smillert} 25b39c5158Smillert 26b39c5158Smillertfor my $test (@schedule) { 27b39c5158Smillert my $name = $test->{name}; 28b39c5158Smillert my $cons = TAP::Formatter::Console->new; 29b39c5158Smillert isa_ok $cons, 'TAP::Formatter::Console'; 30b39c5158Smillert my $method = $test->{method}; 31b39c5158Smillert can_ok $cons, $method; 32b39c5158Smillert is_deeply [ $cons->$method( $test->{in}->() ) ], [ $test->{out}->() ], 33b39c5158Smillert $name; 34b39c5158Smillert} 35b39c5158Smillert 36b39c5158Smillert#### Color tests #### 37b39c5158Smillert 38b39c5158Smillertpackage Colorizer; 39b39c5158Smillert 40b39c5158Smillertsub new { bless {}, shift } 41b39c5158Smillertsub can_color {1} 42b39c5158Smillert 43b39c5158Smillertsub set_color { 44b39c5158Smillert my ( $self, $output, $color ) = @_; 45b39c5158Smillert $output->("[[$color]]"); 46b39c5158Smillert} 47b39c5158Smillert 48b39c5158Smillertpackage main; 49