Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The usage with workspace #117

Open
dalance opened this issue Mar 12, 2020 · 0 comments
Open

The usage with workspace #117

dalance opened this issue Mar 12, 2020 · 0 comments

Comments

@dalance
Copy link

dalance commented Mar 12, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant