Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run perl test in debugger mode?

I try to run test under debugger as:

perl -d $(which prove) t/file.t

But this has no effect because each test is run as separate job.

I have found --exec option, but when I provide it I lost any option from .proverc file and command line

prove -Ithis/is/lost --exec 'perl -d' t/file.t

How to run tests by prove with additional options and do not lose those options which were provided at .proverc file and command line?

I do not want repeat myself and write:

prove --exec 'perl -d -Ilib -Ilocal/lib/perl5' t/file.t

While -Ilib and -Ilocal/lib/perl5 are both at .proverc file

like image 276
Eugen Konkov Avatar asked Mar 15 '17 16:03

Eugen Konkov


1 Answers

You can repeat yourself once if you set the PERL5OPT environment variable.

export DBG_MODE='-d -Ilib -Ilocal/lib/perl5'
prove t/file1.t                       # regular use
PERL5OPT=$DBG_MODE prove t/file2.t    # with debugger

or with an alias or bash function

alias proved='PERL5OPT="-d -Ilib -Ilocal/lib/perl5" prove'
like image 101
mob Avatar answered Oct 05 '22 11:10

mob