Reference asset files from a test


I trying to create some tests for my package, and need some data that is stored in separate non .rs files, how can I handle this? where should I place the files and what path should I use.


cargo sets an environment variable called CARGO_MANIFEST_DIR. This points to the directory containing the Cargo.toml file currently being used by cargo. You can use this path to access the data-files, so long as you know where they are placed relative to CARGO_MANIFEST_DIR.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.