Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

put command line arguments for tests in cabal file?

Tags:

haskell

cabal

Is there a way to write command line arguments for tests (exitcode-stdio-1.0) in the cabal file?

I can run the tests manually with

cabal test --test-options="foo bar"

but I don't want to (re-)type this.

like image 516
d8d0d65b3f7cf42 Avatar asked Mar 06 '15 15:03

d8d0d65b3f7cf42


People also ask

Is it possible to pass command line arguments to a test?

It is possible to pass custom command line arguments to the test module.

How do you pass two command line arguments?

To pass command line arguments, we typically define main() with two arguments : first argument is the number of command line arguments and second is list of command-line arguments. The value of argc should be non negative. argv(ARGument Vector) is array of character pointers listing all the arguments.

What are command line arguments stored as?

Only string values can be passed as command line arguments. All the command line arguments are stored in a character pointer array called argv[ ]. Total count of command line arguments including file path argument is stored in a integer parameter called argc.


1 Answers

There is no way to do this. As the comments suggest, if there are default options for the test-suite, they should just be baked into the executable. Command line options are intended only for overriding or modifying those default options. There is no way to add additional options in the cabal file

like image 199
sclv Avatar answered Sep 21 '22 13:09

sclv