Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Running tests on modules generated by Module::Starter still in /lib directory

by stevieb (Canon)
on Feb 12, 2017 at 18:40 UTC ( [id://1181851]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Running tests on modules generated by Module::Starter still in /lib directory
in thread Running tests on modules generated by Module::Starter still in /lib directory

What exactly does the Vim shortcut run when executed? fwiw, tests should reside in MyModule/t/*.t. Also, you never specified which directory you are in when running the test command. You should be in the distribution's root dir.

You don't need to make install to run tests. make test is a common way to run your suite (all tests), and it automatically knows where to look for your libraries. You only need to do things differently when running individual test files. make install works, but as haukex stated in an earlier reply, it isn't necessary. Both of the below will work all the same, without installing (granted you're in the dist's root dir as I've said):

"perl -Ilib t/foo.t should be enough. Update: or prove -l t/foo.t."

Replies are listed 'Best First'.
Re^4: Running tests on modules generated by Module::Starter still in /lib directory
by nysus (Parson) on Feb 12, 2017 at 18:52 UTC

    It's a nifty little VIM script in that goes in .vimrc file:

    "=====[ Run a Perl module's test suite ]========================= let g:PerlTests_program = 'perltests' " ...What to call let g:PerlTests_search_height = 5 " ...How far up to searc +h let g:PerlTests_test_dir = '/t' " ...Where to look for t +ests augroup Perl_Tests autocmd! autocmd BufEnter *.p[lm] nmap <buffer> ;t :call RunPerlTests()<CR +> autocmd BufEnter *.t nmap <buffer> ;t :call RunPerlTests()<CR +> augroup END function! RunPerlTests () " Start in the current directory... let dir = expand('%:h') " Walk up through parent directories, looking for a test directory +... for n in range(g:PerlTests_search_height) " When found... if isdirectory(dir . g:PerlTests_test_dir) " Go there... silent exec 'cd ' . dir " Run the tests... exec ':!' . g:PerlTests_program " Return to the previous directory... silent cd - return endif " Otherwise, keep looking up the directory tree... let dir = dir . '/..' endfor " If not found, report the failure... echohl WarningMsg echomsg "Couldn't find a suitable" g:PerlTests_test_dir '(tried' g +:PerlTests_search_height 'levels up)' echohl None endfunction

    The VIM script makes use of a perltests script in ~/bin which finds the tests and executes them via TAP::Harness which itself can take a lib argument when creating a new object. So it seems like I should be able to put something in there to make this work. The beauty of it is I can do ;t keystroke and run tests.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1181851]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-19 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found