-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
How use extern crate in a doctest? #960
Comments
I think Rustdoc doesn't allow this :/ |
Can you paste the full error log from what you were trying to do? Rustdoc tests definitely allow for |
|
Ah that's just part of how rustdoc wraps all tests in a
|
But I want to have multiple doctest examples in multiple places. It would be nice to be able to specify a "prelude" of declarations for use in multiple doctests. In any case, it would be nice to have an explicit semantics of how doctest is supposed to work. I confess that all I could do was look at random Rust source code and http://doc.rust-lang.org/rustdoc.html#testing-the-documentation and guess what to do. I really like the doctest concept. |
Yes unfortunately you'll have to duplicate the logic across doc tests, and we also do not have a formal specification for this as-is, but you can see the function here |
Related to the request to specify a "prelude": rust-lang/rfcs#919 |
I tried the following in a doctest and it failed. I do not know a workaround.
The text was updated successfully, but these errors were encountered: