I'm on a project interacting with files, and I would like to use text files to test my work. However tests aren't run from the tests/
directory, and thus I
cannot reliably find them when running cargo run
.
Does cargo
handle this by always running test from the root directory (which seems to be the case but I didn't find anything attesting it)?
相关问题
- Share Arc between closures
- Function references: expected bound lifetime param
- Pattern matching on slices
- How can I iteratively call Sha256::digest, passing
- Destructure a vector into variables and give away
相关文章
- How can I convert a f64 to f32 and get the closest
- What is a good way of cleaning up after a unit tes
- Web Test recorder does not allow me to record a te
- Factory_girl has_one relation with validates_prese
- What is the difference between `assert_frame_equal
- How can I unpack (destructure) elements from a vec
- How to import macros in Rust?
- How do I send cookies with request when testing Fl
I believe that the environment variable
CARGO_MANIFEST_DIR
can give you a stable base point:Some info cribbed from How can a Rust program access metadata from its Cargo package?.