perltestingperl-prove

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


Solution

  • 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'