gugod/Test-Continuous

options with parameters not always correctly passed to prove

Opened this issue · 1 comments

I want to pass the -I lib/ parameter to prove to make it look in another base directory for my files.

When I run autoprove -I lib/, the initial test run is OK and the parameter is passed to prove like this:

prove --norc -v -m -I lib/ ::
ALL PASSED
t/01.instance.t:
# Subtest: instance
# Subtest: inheritance

When I then change a file, autoprove picks up the change and runs prove again, but this time the lib/ is missing from the -I parameter and gets replaced by the test to run, which completely breaks my tests:

prove --norc -v -m -I t/01.instance.t ::
3 planned, only 0 passed.
Failed test(s) in t/00.load.t: 1
 Non-zero exit status: t/00.load.t
Failed test(s) in t/01.instance.t: 1 2
 Non-zero exit status: t/01.instance.t
t/01.instance.t:
Can't locate object method "new" via package "Log::Dispatch::Desktop::Notify" (perhaps you forgot to load "Log::Dispatch::Desktop::Notify"?) at t/01.instance.t line 7.t/01.instance.t:
#   Failed test 'use Log::Dispatch::Desktop::Notify;'
#   at t/01.instance.t line 4.
#     Tried to use 'Log::Dispatch::Desktop::Notify'.
#     Error:  Can't locate Log/Dispatch/Desktop/Notify.pm in @INC (you may need to install the Log::Dispatch::Desktop::Notify module) (@INC contains: /home/mitch/git/log-dispatch-desktop-notify/t/01.instance.t /home/mitch/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/mitch/perl5/lib/perl5 /home/mitch/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/mitch/perl5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at t/01.instance.t line 4.
# BEGIN failed--compilation aborted at t/01.instance.t line 4.
# Subtest: instance
# No tests run!
#   Failed test 'No tests run for subtest "instance"'
#   at t/01.instance.t line 9.
# Looks like your test exited with 255 just after 2.

------------------------------------------------------------

It looks like Test::Continuous::_classify_opts() splits the parameters by type so that -I ends up in @not_files while lib/ ends up in @tests (because it is a directory).

Both -I and lib/ should instead end up in @not_files to be passed to prove without any changes.

…10 seconds after opening this issue I reread the prove manpage and found out that -I lib can be shortened to a single -l parameter which also works with autoprove.
So I have a workaround for my current problem.

But the basic problem remains: Any prove option with an argument that looks like a file or directory will break. -I and -e could both be problematic.