Skip to content

Instantly share code, notes, and snippets.

@omega
Created April 24, 2012 19:27
Show Gist options
  • Save omega/2482928 to your computer and use it in GitHub Desktop.
Save omega/2482928 to your computer and use it in GitHub Desktop.
diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm
index 9e63793..0d041c7 100644
--- a/lib/Test/Harness.pm
+++ b/lib/Test/Harness.pm
@@ -246,6 +246,11 @@ sub _new_harness {
elsif ( $opt eq 'c' ) {
$args->{color} = 1;
}
+ elsif ( $opt =~ m/^f(.*)$/ ) {
+ my $fmt = $1;
+ $fmt =~ s/-/::/g;
+ $args->{formatter_class} = $fmt;
+ }
else {
die "Unknown HARNESS_OPTIONS item: $opt\n";
}
diff --git a/t/compat/env.opts.t b/t/compat/env.opts.t
new file mode 100644
index 0000000..6f5a8a6
--- /dev/null
+++ b/t/compat/env.opts.t
@@ -0,0 +1,28 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More (
+ $^O eq 'VMS'
+ ? ( skip_all => 'VMS' )
+ : ( tests => 7 )
+);
+
+use Test::Harness;
+{
+ # Should add a fake home dir? to test the rc stuff..
+ local $ENV{HARNESS_OPTIONS} = 'j4:c';
+
+ ok my $harness = Test::Harness::_new_harness, 'made harness';
+ is($harness->color, 1, "set color correctly");
+ is($harness->jobs, 4, "set jobs correctly");
+}
+{
+ # Should add a fake home dir? to test the rc stuff..
+ local $ENV{HARNESS_OPTIONS} = 'j4:c:fTAP-Formatter-SocketConsole';
+
+ ok my $harness = Test::Harness::_new_harness, 'made harness';
+ is($harness->color, 1, "set color correctly");
+ is($harness->jobs, 4, "set jobs correctly");
+ is($harness->formatter_class, "TAP::Formatter::SocketConsole", "correct formatter");
+
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment