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

rustdoc --test only detects rust vs. markdown based on filename #35065

Closed
lambda opened this issue Jul 27, 2016 · 1 comment
Closed

rustdoc --test only detects rust vs. markdown based on filename #35065

lambda opened this issue Jul 27, 2016 · 1 comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: Writing correctness tests. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.

Comments

@lambda
Copy link
Contributor

lambda commented Jul 27, 2016

If I run rustdoc --test on something that doesn't have a file extension, it interprets it as Rust code. This makes it inconvenient to run on something piped in, say via Bash process redirection:

$ rustdoc --test <(curl http://words.steveklabnik.com/structure-literals-vs-constructors-in-rust | pandoc -f html -t markdown)
/dev/fd/63:1:1: 1:2 error: unknown start of token: \u{a0}
/dev/fd/63:1
             ^
/dev/fd/63:1:1: 1:2 help: unicode character ' ' (No-Break Space) looks much like ' ' (Space), but it's not
/dev/fd/63:1
             ^
thread '<unnamed>' panicked at 'Box<Any>', ../src/libsyntax/parse/lexer/mod.rs:198
note: Run with `RUST_BACKTRACE=1` for a backtrace.

$ curl http://words.steveklabnik.com/structure-literals-vs-constructors-in-rust | pandoc -f html -t markdown > test.md
$ rustdoc --test test.md

running 9 tests
test _0 ... FAILED
# etc ...

There isn't any way to override this, by providing a --markdown flag or the like.

Also, for this use case, would be nice if you could provide input on stdin instead of via bash process redirection.

@Mark-Simulacrum
Copy link
Member

This appears to work today. I think it could use a run-make test, so E-needstest.

running 1 test
test /dev/fd/63 - main (line 1) ... FAILED

failures:

---- /dev/fd/63 - main (line 1) stdout ----
	thread 'rustc' panicked at 'test executable failed:

thread 'main' panicked at 'assertion failed: `(left == right)` (left: `10`, right: `5`)', <anon>:2
note: Run with `RUST_BACKTRACE=1` for a backtrace.

', /checkout/src/librustdoc/test.rs:313
note: Run with `RUST_BACKTRACE=1` for a backtrace.


failures:
    /dev/fd/63 - main (line 1)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured

@Mark-Simulacrum Mark-Simulacrum added the E-needs-test Call for participation: Writing correctness tests. label May 9, 2017
@frewsxcv frewsxcv added the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label May 18, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: Writing correctness tests. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants