rust-skeptic
rust-skeptic copied to clipboard
The usage with workspace
I want to use rust-skeptic with workspace. My project structure is like below:
$ tree
.
|-- Cargo.lock
|-- Cargo.toml
|-- README.md
|-- crate-A
| |-- build.rs
| |-- Cargo.toml
| |-- src
| | `-- lib.rs
`-- crate-B
|-- Cargo.toml
`-- src
`-- lib.rs
I want to test README.md with crate-A, so build.rs of crate-A is below:
fn main() {
skeptic::generate_doc_tests(&["../README.md"]);
}
This works fine with cargo test, but cargo package is failed.
This is because cargo package copies files in crate-A to target/package/crate-A-xxx, build.rs is executed in the target directory, and ../README.md can't be found.
My current workaround is below:
fn main() {
let path = std::path::PathBuf::from("../README.md");
if path.exists() {
skeptic::generate_doc_tests(&[path]);
}
}
Is there any idea to fix it? I think either the improvement of rust-skeptic or the extra instruction of README.md is required.