Skip Menu |

This queue is for tickets about the Test-Harness CPAN distribution.

Report information
The Basics
Id: 132546
Status: new
Priority: 0/
Queue: Test-Harness

People
Owner: Nobody in particular
Requestors: Dan [...] DWright.Org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.43_02
Fixed in: (no value)



Subject: Feature request: Allow App::Prove::_get_args() to accept arbitrary harness constructor arguments.
The ultimate objective here is to be able to run prove --harness=TAP::Harness::JUnit AND be able to pass in the "xmlfile" argument to the JUnit constructor. https://metacpan.org/pod/TAP::Harness::JUnit#xmlfile TAP::Harness::JUnit is being constructed by TAP::Object::_construct(), which receives an @args array from its caller: https://metacpan.org/release/Test-Harness/source/lib/TAP/Object.pm#L130 TAP::Object::_construct() is being invoked in TAP::Harness::Env::create(). The arguments it passes in a hashref of %args it constructs locally as well as an %input hash from its caller https://metacpan.org/release/Test-Harness/source/lib/TAP/Harness/Env.pm#L118 TAP::Harness::Env->create() is being invoked by App::Prove::_runtests. The input hash it passes in ultimately ends up being the output from App::Prove::_get_args(): https://metacpan.org/release/Test-Harness/source/lib/App/Prove.pm#L532 https://metacpan.org/release/Test-Harness/source/lib/App/Prove.pm#L506 Regretfully, _get_args() only allows a finite set of arguments. It does NOT allow you to specify arbitrary arguments to be passed into the harness constructor. This means that regardless of whatever harness you use, you are limited in functionality to the set of arguments that _get_args() already knows about. My proposal is to include a command-line option that permits arbitrary arguments to be passed into the harness constructors. This will improve support for all current harnesses and any harnesses in the future. I don't have any strong feelings about the syntax. Perhaps something like this: prove --harness=TAP::Harness::JUnit --harness-arg=xmlfile:whatever.xml --harness-arg=package:database But really any syntax is fine with me. Admittedly, this is only going to help with scalar arguments. Anything that requires a different type of structure won't be served by this improvement. But this is still a very useful step forward. I'm happy to offer a patch if you agree with the proposal. Thanks, -Dan