Coder Social home page Coder Social logo

Compiling tests fails about docopt.rs HOT 8 CLOSED

docopt avatar docopt commented on June 3, 2024
Compiling tests fails

from docopt.rs.

Comments (8)

BurntSushi avatar BurntSushi commented on June 3, 2024

Oh, neat. I didn't realize Cargo automatically checked examples for me. (I've still been using make test.)

I don't really know how to use cargo test. Specifically, the examples require that docopt_macros is built. So there needs to be a way to specify a dependency on docopt_macros in root/Cargo.toml for testing?

@alexcrichton Any ideas? Is this possible yet?

from docopt.rs.

alexcrichton avatar alexcrichton commented on June 3, 2024

This is little unfortunate, there's not necessarily a great way to express this as you'll end up with in theory some circular dependencies.

That being said, if you add this to your top-level Cargo.toml the examples will build:

[dev-dependencies.docopt_macros]
path = "docopt_macros"

This in theory induces a circular dependency of docopt with itself, but it turns out that your Cargo.toml for docopt_macros depends on the git version of docopt, not the local version. This means that when you run cargo test you'll build two versions of the docopt library, then the tests will pass.

Another alternative would be to have /examples and /docopt_macros/examples. If you split it like that then everything will "just work" because the examples that use the docopt_macros crate will have it available and the other examples won't. Does that make sense?

from docopt.rs.

BurntSushi avatar BurntSushi commented on June 3, 2024

Ah ha! Splitting the examples makes a lot of sense. I'll probably go that route. Seems simplest.

So when I do that, a new problem arises. When I cd into docopt_macros and run cargo test, it tries to compile docopt_macros with the git version of docopt. But really, I'd like to test it against my local copy before pushing to the world. I could modify my config to use path, but is there any other way? (I tried adding dev-dependencies.docopt to docopt_macro's Cargo.toml, but it ends up compiling both versions of docopt when running cargo test (understanable) and that leads to trouble.)

from docopt.rs.

BurntSushi avatar BurntSushi commented on June 3, 2024

Hmm, I can't seem to get any kind of cargo test to work in ./docopt_macros. I've tried using path instead of git to point to the docopt dependency, but cargo tells me:

[andrew@Liger docopt_macros] cargo test
   Compiling docopt v0.6.0 (file:/home/andrew/data/projects/docopt.rs/docopt_macros)
   Compiling docopt_macros v0.6.0 (file:/home/andrew/data/projects/docopt.rs/docopt_macros)
/home/andrew/data/projects/docopt.rs/docopt_macros/target/test/docopt_macros-754b83a3bcc7f2df: error while loading shared libraries: libdocopt-bea495e631e19a4e.so: cannot open shared object file: No such file or directory
Could not execute process `/home/andrew/data/projects/docopt.rs/docopt_macros/target/test/docopt_macros-754b83a3bcc7f2df` (status=127)

Cargo.toml:

[package]
name = "docopt_macros"
version = "0.6.0"
authors = ["Andrew Gallant <[email protected]>"]

[[lib]]
name = "docopt_macros"
path = "src/macro.rs"
plugin = true

[dependencies.docopt]
# git = "https://github.com/BurntSushi/docopt.rs" 
path = "/home/andrew/data/projects/docopt.rs"

from docopt.rs.

alexcrichton avatar alexcrichton commented on June 3, 2024

Hm, I think that's a bug in rustdoc, I'll look into it!

from docopt.rs.

alexcrichton avatar alexcrichton commented on June 3, 2024

cargo*

from docopt.rs.

alexcrichton avatar alexcrichton commented on June 3, 2024

Should be fixed in master now!

from docopt.rs.

BurntSushi avatar BurntSushi commented on June 3, 2024

Great, that seems to fix the docopt_macros problem. Thanks! Although, now in docopt, cargo test runs rustdoc, but that fails because the doc tests require docopt_macros. I'll try to file a proper bug report.

from docopt.rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.