samedi 7 juillet 2018

Can I actually build and run an executable from the same package as part of a test suite?

It struck me that I do not really know of a way to black box test an executable packaged with Cabal.

With npm, for instance, I can run arbitrary shell commands, and I surely can wire it so that the necessary sources are transpiled and executed, and their side effects inspected.

Stack (as said here) builds the executables and publishes them in $PATH for the test suite, so I can easily run them.

But with Cabal, a test suite apparently cannot even depend on an executable, so there is no way to force the latter to be built. (Am I wrong about this?) And even then, I would have to know the path to the compiled binary.

How do I approach this problem?

The particulars of my situation are that an executable must extensively analyze the state of the system and branch accordingly, and I want to integration test that it does not forget to do so.

Aucun commentaire:

Enregistrer un commentaire