I’m trying to write a custom test where I feed some test data to the main executable of my project via standard in. Is there a way to do this?
Here’s what I have so far.
(action (run dune exec my_proj_exe < test.txt))
I don’t think the redirect actually works, since the test hangs. I think
< is treated as an argument to
This is not possible via the action DSL at the moment, you need to use a shell command:
(system "my_proj_exe < test.txt"). Although, it seems like a
(with-stdin-from <file> <action>) construction would be a fine addition since we already have
(with-stdout-to <file> <action>).
dune exec here feels a bit odd, why not do
(run my_proj_exe ...) directly?
I had dune exec because I didn’t know that I could just call the program directly. Thanks for letting me know!
(with-stdin-from ...) has just been merged into
Will this be backported to dune 1.11.x, or is perhaps dune-2.0 right around the corner?
The plan is to release Dune 2 in max 2 weeks We are not planning to backport features to 1.11.x, only bugfixes.