-
Notifications
You must be signed in to change notification settings - Fork 742
"cargo test" failing because of docblocks? #378
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
Comments
So as you said, these doc tests doesn't make any sense, given they're C code... Is there any kind of compiler annotation that we could use to tell Easiest short-term solution is adding an option to avoid generating comments, but that's... not ideal. I can imagine how could we process comments so |
I don't think there is something we can put in rust code directly which would ignore the doc tests of a module (would be ideal), for now I think turning off doctests for the -sys crate works good enough: [lib]
doctest = false But of course this also rules out any doctests which one could add on top of the auto-generated ones, so I think a "code fix" is needed at some point. |
I'm going to try to patch rustdoc upstream to support:
#[doc(test(ignore))]
On testable items. This will solve the issue nicely I think.
…On Wed, Jan 04, 2017 at 04:00:35AM -0800, Michael Nitschinger wrote:
I don't think there is something we can put in rust code directly which would ignore the doc tests of a module (would be ideal), for now I think turning off doctests for the -sys crate works good enough:
```toml
[lib]
doctest = false
```
But of course this also rules out any doctests which one could add on top of the auto-generated ones, so I think a "code fix" is needed at some point.
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#378 (comment)
|
That would be great - how would that work in this autogenerated context? Would libbindgen add those options or would it be possible to do that on the module where we "inject" the code? |
You could either: #[doc(test(ignore))]
mod bindings {
include!("/path/to/autogenerated/bindings.rs")
} or use the
or builder.raw_line("#![doc(test(ignore))]"); |
Sounds great 👍 looking forward to it! |
This allows to ignore tests in modules we know they have uneffective tests, or tests not under our control, like for example in: rust-lang/rust-bindgen#378 Signed-off-by: Emilio Cobos Álvarez <[email protected]>
Let's track this in #426 instead, which seems a bit more general. Thanks for the report! |
Hello,
As part of using
rust-bindgen
to build libcouchbase bindings, I'm runningcargo test
to run the automatically created sanity tests.As it turns out the function tests are fine, but somehow the rust doc tests get tripped up by some docs in the c code (I think?).
So my question is: do those doc tests even make sense? If so, I'm happy to help getting it to work, if not maybe there is an option to add
no_run
to those to avoid the test suite failing?Thanks!
The text was updated successfully, but these errors were encountered: