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

Expected include to be processed before mdbook test #855

Closed
carols10cents opened this issue Dec 19, 2018 · 1 comment · Fixed by #891
Closed

Expected include to be processed before mdbook test #855

carols10cents opened this issue Dec 19, 2018 · 1 comment · Fixed by #891
Labels
A-Tests Area: `mbdook test` related tests

Comments

@carols10cents
Copy link
Member

carols10cents commented Dec 19, 2018

What happened:

I'm experimenting with extracting code examples from TRPL into their own files for a variety of reasons. However, I'd like to retain the mdbook test functionality.

I extracted an example that compiles and currently passes mdbook test into its own file in this commit.

I then ran mdbook test, and got this error (mdbook --version = v0.1.7):

failures:

---- /var/folders/qc/0ry2bjtd7wd9q8r1c7wylplr0000gn/T/mdbookmFaM3A/ch03-01-variables-and-mutability.md - _::Variables_and_Mutability (line 74) stdout ----
error: expected `[`, found `include`
 --> /var/folders/qc/0ry2bjtd7wd9q8r1c7wylplr0000gn/T/mdbookmFaM3A/ch03-01-variables-and-mutability.md:75:4
  |
3 | {{#include ../examples/ch03-01-variables-and-mutability/unnumbered-02/src/main.rs }}
  |    ^^^^^^^ expected `[`

thread '/var/folders/qc/0ry2bjtd7wd9q8r1c7wylplr0000gn/T/mdbookmFaM3A/ch03-01-variables-and-mutability.md - _::Variables_and_Mutability (line 74)' panicked at 'couldn't compile the test', librustdoc/test.rs:332:13

I just tried with mdbook 0.2.2 and got the same result. I'm using Rust 1.31.0.

What I expected to happen:

I expected the #include preprocessing to happen before running doctests so that mdbook test would have the same behavior as it did before I extracted the file. It looks like that's not happening because rustdoc is trying to compile {{#include.

@VentGrey
Copy link

VentGrey commented Jan 19, 2019

Also experiencing this issue, it looks like mdbook just renders one type of file when {{#include}} is invoked and ignores the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Tests Area: `mbdook test` related tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants