Skip to content

Commit

Permalink
Move the History->consume tests into their own test.
Browse files Browse the repository at this point in the history
They're a bit complicated.

For #198
  • Loading branch information
schwern committed May 25, 2012
1 parent af577ec commit e47df19
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
32 changes: 0 additions & 32 deletions t/History/HistoryStats.t
Expand Up @@ -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 );
Expand Down
36 changes: 36 additions & 0 deletions t/History/consume.t
@@ -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.