From 008915867036a277f7428504b4403e35d6f705c0 Mon Sep 17 00:00:00 2001 From: "Michael G. Schwern" Date: Mon, 5 Dec 2011 23:00:09 -0800 Subject: [PATCH] Emulate the existing behavior and pretend the test already started. Doing this mostly for compatibility. For #242 --- lib/Test/Builder/Tester.pm | 7 ++++++- t/Tester/change_formatter.t | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/Test/Builder/Tester.pm b/lib/Test/Builder/Tester.pm index 936141574..78154b678 100644 --- a/lib/Test/Builder/Tester.pm +++ b/lib/Test/Builder/Tester.pm @@ -92,13 +92,18 @@ sub _start_testing { # Make a detached TestState my $state = $original_state->create( - formatters => [$formatter], + formatters => [], # Preserve existing handlers early_handlers => $original_state->early_handlers, late_handlers => $original_state->late_handlers, ); + # To emulate existing behavior, start testing but don't + # let the formatter see it + $state->post_event( TB2::Event::TestStart->new ); + $state->add_formatters($formatter); + # remember that we're testing $testing = 1; diff --git a/t/Tester/change_formatter.t b/t/Tester/change_formatter.t index d114a0ae8..38e426018 100644 --- a/t/Tester/change_formatter.t +++ b/t/Tester/change_formatter.t @@ -9,8 +9,7 @@ use Test::More; note "change_formatter_class"; { change_formatter_class("TB2::Formatter::TAP"); - test_out("TAP version 13"); - test_out("1..2"); - plan tests => 2; + test_out("ok 1"); + ok(1, ""); test_test("using the new formatter"); }