Test-More / TB2

Test::Builder version 2, the next generation of building testing modules in Perl
Other
1 stars 0 forks source link

Allow a history object to populate itself based on another history object. #110

Closed schwernbot closed 10 years ago

schwernbot commented 10 years ago

From: @schwern Date: Tuesday Sep 14, 2010 at 01:08 GMT Orig: https://github.com/Test-More/test-more/issues/72

This is a convenience constructor feeding all the events of one History object into a new one.

my $history = Some::Class::History->copy($old_history);

The above is roughly equivalent to:

my $history = Some::Class::History->create;
$history->add_test_history for $old_history->results;

Plus events once that comes in. All the primary information stored in $old_history is fed into $history. None of the derived information is.

The use case is when you want to replace the existing history object with one that acts differently but want to preserve history.

schwernbot commented 10 years ago

From: @notbenh Date: Tuesday Sep 14, 2010 at 21:46 GMT Orig: https://github.com/Test-More/test-more/issues/72#issuecomment-407105

If this is a feature that we want to support then I'm going to say that we scrap the idea of the 'all in one event stream' in favor of separate begin/result/end stacks. I'm all for having a method that returns all three in order but if there all the same stack then we can't just simply push $old -> $new.

Also do you think that there will be cases where you want to overwrite history? If so then would it make more sense to do this at the 'singleton' idea where you just swap out objects, not the content of those objects?

schwernbot commented 10 years ago

From: @schwern Date: Thursday Oct 07, 2010 at 19:44 GMT Orig: https://github.com/Test-More/test-more/issues/72#issuecomment-454733

Solved by TB2::History->consume