mardi 9 octobre 2018

Testing with `use-ok` on modules with a `MAIN` definition

I wrote a new module, and would like to be able to test whether all parts can be used correctly. For this, I'm using the use-ok subroutine from the Test module. I'm trying to easily test all module files using the following code:

"META6.json".IO.slurp.&from-json<provides>
.grep(*.value.starts-with("lib")).Hash.keys
.map({ use-ok $_ })

My issue here is that there are a few files that contain a definition for a MAIN subroutine. From the output I see when running prove, it looks like on of the files is having their MAIN executed, and then the testing stops.

I want to test whether these files can be used correctly, without actually running the MAIN subs that are defined within them. How would I do this?

Aucun commentaire:

Enregistrer un commentaire