summaryrefslogtreecommitdiff
path: root/cpan/Test-Harness/t/console.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-02 15:57:26 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-02 15:57:26 +0100
commitb8a2040150d386de90994afd87f9d01bd861104a (patch)
tree9418ac04b77045e3bb187954c5fbf873557f7474 /cpan/Test-Harness/t/console.t
parent8d4ff56f76907d1619ddc5fd7040d3823057ec47 (diff)
downloadperl-b8a2040150d386de90994afd87f9d01bd861104a.tar.gz
Move Test::Harness from ext/ to cpan/
Diffstat (limited to 'cpan/Test-Harness/t/console.t')
-rw-r--r--cpan/Test-Harness/t/console.t47
1 files changed, 47 insertions, 0 deletions
diff --git a/cpan/Test-Harness/t/console.t b/cpan/Test-Harness/t/console.t
new file mode 100644
index 0000000000..32f5db62ac
--- /dev/null
+++ b/cpan/Test-Harness/t/console.t
@@ -0,0 +1,47 @@
+use strict;
+use lib 't/lib';
+use Test::More;
+use TAP::Formatter::Console;
+
+my @schedule;
+
+BEGIN {
+ @schedule = (
+ { method => '_range',
+ in => sub {qw/2 7 1 3 10 9/},
+ out => sub {qw/1-3 7 9-10/},
+ name => '... and it should return numbers as ranges'
+ },
+ { method => '_balanced_range',
+ in => sub { 7, qw/2 7 1 3 10 9/ },
+ out => sub { '1-3, 7', '9-10' },
+ name => '... and it should return numbers as ranges'
+ },
+ );
+
+ plan tests => @schedule * 3;
+}
+
+for my $test (@schedule) {
+ my $name = $test->{name};
+ my $cons = TAP::Formatter::Console->new;
+ isa_ok $cons, 'TAP::Formatter::Console';
+ my $method = $test->{method};
+ can_ok $cons, $method;
+ is_deeply [ $cons->$method( $test->{in}->() ) ], [ $test->{out}->() ],
+ $name;
+}
+
+#### Color tests ####
+
+package Colorizer;
+
+sub new { bless {}, shift }
+sub can_color {1}
+
+sub set_color {
+ my ( $self, $output, $color ) = @_;
+ $output->("[[$color]]");
+}
+
+package main;