Test-More / TB2

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

Create a NoHistory object rather than $history->should_keep_history #94

Closed schwernbot closed 10 years ago

schwernbot commented 10 years ago

From: @schwern Date: Saturday Aug 28, 2010 at 04:24 GMT Orig: https://github.com/Test-More/test-more/issues/46

Rather than have a flag saying whether to keep history or not, have a subclass of History that does not store individual results.

It can keep summary information as long as that summary consumes O(1) memory. is_passing(), for example, and perhaps a summary of the number of tests which passed, failed, seen, etc...

It will throw an exception if you ask for information it does not have, like results() and summary().

For bonus points, allow a NoHistory object to be generated from a History object. That would summarize and store the current historical state for continuity.

schwernbot commented 10 years ago

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

NoHistory Object

http://github.com/notbenh/test-more/blob/f5bd716b1763229d95d7b2b9d35679a768b70e90/lib/Test/Builder2/NoHistoryStack.pm

HistoryStack now has a consume method that will take a list of history objects (currently only HistoryStack's) and replay the history in the consuming object.

http://github.com/notbenh/test-more/commit/f5bd716b1763229d95d7b2b9d35679a768b70e90

So to 'strip' history would look something like:

my $no_history = Test::Builder2::NoHistoryStack->create->consume($history);

schwernbot commented 10 years ago

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

Solved by Test::Builder2::NoHistory.