Permalink
Browse files

Move the History->consume tests into their own test.

They're a bit complicated.

For #198
  • Loading branch information...
1 parent af577ec commit e47df19f89ddaa9149595130510fc56afb6f148e @schwern schwern committed May 25, 2012
Showing with 36 additions and 32 deletions.
  1. +0 −32 t/History/HistoryStats.t
  2. +36 −0 t/History/consume.t
View
@@ -49,38 +49,6 @@ note "basic history stats"; {
}
-note "merge history stacks"; {
- my $H1 = new_history;
- my $ec1 = MyEventCoordinator->new(
- history => $H1
- );
-
- $ec1->post_event($_) for Pass(), Pass(), Pass();
- is $H1->result_count, 3, q{H1 count};
-
- my $H2 = new_history;
- my $ec2 = MyEventCoordinator->new(
- history => $H2
- );
-
- $ec2->post_event($_) for Fail(), Fail(), Fail();
- is $H2->result_count, 3, q{H2 count};
-
- $H1->consume($H2);
- is $H1->result_count, 6, q{H1 consumed H2};
- is $H1->fail_count, 3 , q{H1 picked up the tests from H2 correctly};
-
- my $h = new_history;
- my $ec = MyEventCoordinator->new( history => $h );
- $ec->post_event($_) for Pass(), Fail();
-
- $H1->consume( $h ) for 1..10;
-
- is $H1->result_count, 26, q{consume appends history};
-
-}
-
-
note "multiple results with same test number"; {
my $h = new_history;
my $ec = MyEventCoordinator->new( history => $h );
View
@@ -0,0 +1,36 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+BEGIN { require 't/test.pl' }
+
+my $CLASS = "TB2::History";
+use_ok $CLASS;
+use TB2::Events;
+
+note "merge history stacks"; {
+ my $h1 = $CLASS->new;
+
+ my $pass = TB2::Result->new_result( pass => 1 );
+ my $fail = TB2::Result->new_result( pass => 0 );
+
+ $h1->accept_event($_) for $pass, $pass, $pass;
+ is $h1->result_count, 3, q{H1 count};
+
+ my $h2 = $CLASS->new;
+
+ $h2->accept_event($_) for $fail, $fail, $fail;
+ is $h2->result_count, 3, q{H2 count};
+
+ $h1->consume($h2);
+ is $h1->result_count, 6, q{H1 consumed H2};
+ is $h1->fail_count, 3 , q{H1 picked up the tests from H2 correctly};
+
+ my $h3 = $CLASS->new;
+ $h3->accept_event($_) for $pass, $fail;
+
+ $h1->consume( $h3 ) for 1..10;
+
+ is $h1->result_count, 26, q{consume appends history};
+}

0 comments on commit e47df19

Please sign in to comment.