Problems? Is your data what you think it is? | |
PerlMonks |
Re: Portably unit testing scriptsby Discipulus (Canon) |
on Oct 26, 2019 at 12:11 UTC ( [id://11107989]=note: print w/replies, xml ) | Need Help?? |
Hello wanna_code_perl, First I second what haukex said. If you have a library, a perl module, test what this module exports. The cli is just an interface. Second: your example is not a modulino. A modulino is a perl module .pm file that can be invoked as a program via a trick. A modulino should end with the famous 1; or cannot be loaded. If your is a modulino you can use it in your testing program and play with their subs, testing them as you wish. In both cases, modulino or standalone script, you can test it somehow, using Capture::Tiny (without embarking yourself in a fight with Run3 modules.. ;). you can also launch the script and inspect the exit values. Few example I have in some test on github something you can adapt:
See also testing in my bibliotheca and Test::Script from CPAN. L*
There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
In Section
Seekers of Perl Wisdom
|
|