I’m writing a program that executes another program with different args and then makes decisions based on the stdout of it. I’m using my mac to program, however this other program runs on linux and anyway it wouldn’t be nice to write tests that use such program since would complicate CI, etc.
I thought I had the solution by making a rust file under the bin folder. That produces an executable with that name, and all I need to do there is to
println! a mock of the other program. Genius! Or is it? I’m not sure if it’s a smart or dumb way of doing it!
A clear problem with that is that cargo runs on the root folder, and the mock program goes to
/target/debug or wherever, depending if I’m debugging or not, and it get a random string appended to its filename, so i can’t seem to be able to target it with an hardcoded path.
I’ve looked into cargo, cargo.toml, etc, but I can’t find a way to just compile that bin executable to a set folder!