Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add a config event? #186

Closed
schwern opened this Issue · 0 comments

1 participant

@schwern
Owner

Currently, Test::Builder configures the TAP formatter directly. Things like whether it should use test numbers, whether it should show the TAP version or the header and so on.

This is dicey for several reasons...

  • The formatter may not be a TAP formatter and it doesn't always check.
  • Some changes are relevant to multiple types of formatters... some are not.
  • It's calling non-standard methods.
  • History and other event watchers do not see these changes which constitute special state changes.

It might make sense to instead have a Config event which contains key/value pairs to be configured.

# Signal not to use test numbers
my $config = Test::Builder2::Event::Config->new( use_test_numbers => 0 );

Each watcher can decide what to do with that information in accept_config. We can build up what various keys and values mean.

In addition, a Config event can contain special instructions for certain types of watchers. For example, this would indicate information only of interest to formatters.

my $config = Test::Builder2::Event::Config->for_class( "Test::Builder2::Formatter" => { use_test_numbers => 0 });

Passing stuff into new is equivalent to calling for_class( "UNIVERSAL" => \%args ).

EventWatchers would ask the Config event for what is of interest to it.

my $args = $config->for_me($self);
@schwernbot schwernbot referenced this issue in Test-More/TB2
Open

Add a config event? #31

@schwern schwern closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.