Join GitHub today
Testing is possible #7
This is not intended as a right testing way of the application.
But here we go.
To test a sub() we do "bootstrap-perl" and define $no_run beforehand.
To test the whole application we can test all the issued external commands in "dry" mode. Dry mode means that extenal commands are not actually get executed. To do so we modify the application code to redefine print_and_system(), open() calls. Then we eval the modified code. Thus on every call to print_and_system() our new function gets called. We see what external command was called and compare to expected one. Some fake output is returned when needed. Values of internal variables can be tested. See xt/commands.t and xt/dry_run.pl for details.
I would happily accept it but maybe after I merged some other pull requests this one doesn't apply anymore without conflicts. Can you rebase it accordingly? It looks like a separate approach containing the others but I'm a bit time-bound to resolve them on my own. Thanks.
added a commit
this pull request
Apr 4, 2015
Ok, I merge and give them a try. Thank you!
Fyi, in a separate branch "metainfo-in-config" I started reworking some stuff.