The program takes an path to a configuration file. E.g. cargo run -- -c path/to/yaml
.
This does not however work with cargo test. cargo test -- -c path/to/yaml
and following error will occur: error: Unrecognized option: 'c'.
Attempts and research
Clap provide a method fn from_args() -> Self
, but did not fully know how this would solve the problem. A similar problem was solved by making it a integration test and add
[[test]]
name = "cpp_test"
# path = "tests/cpp_test.rs" # This is automatic; you can use a different path if you really want to.
harness = false
to the cargo.toml file.
In my case I want to test some functions and thus unit test. I do not believe this would work.