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