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