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

Cargo doctest output in nightly is incorrect #39592

Closed
SergioBenitez opened this issue Feb 6, 2017 · 2 comments
Closed

Cargo doctest output in nightly is incorrect #39592

SergioBenitez opened this issue Feb 6, 2017 · 2 comments

Comments

@SergioBenitez
Copy link
Contributor

In the latest nightly, the logged output for doctests has changed to what appears to be a terser version. Unfortunately, the output is incorrect. The output shows every doctest as occurring in the same file, regardless of where the doctest is. Furthermore, doctest logging no longer includes the module/item where the doctest was declared, which, in my opinion, is a rather large usability regression.

Here is what the new, buggy output looks like:

test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 104 ... ignored
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 116 ... ignored
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 125 ... ignored
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 13 ... ignored
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 130 ... ignored
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 14 ... ignored
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 103 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 133 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 112 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 117 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 140 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 110 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 101 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 123 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 113 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 144 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 120 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 108 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 17 ... ignored
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 101 ... ok
test /home/travis/build/SergioBenitez/Rocket/lib/src/lib.rs - line 112 ... ok

You can find the complete output in the Travis logs for a recent build of Rocket.

@alexcrichton
Copy link
Member

cc @GuillaumeGomez

@GuillaumeGomez
Copy link
Member

Hum, interesting. Looking to find why.

frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 8, 2017
…_file, r=alexcrichton

Display correct filename with --test option

Fixes rust-lang#39592.

With the current files:

```rust
pub mod foo;

/// This is a Foo;
///
/// ```
/// println!("baaaaaar");
/// ```
pub struct Foo;

/// This is a Bar;
///
/// ```
/// println!("fooooo");
/// ```
pub struct Bar;
```

```rust
// note the whitespaces
/// ```
/// println!("foo");
/// ```
pub fn foo() {}
```

It displays:

```
./build/x86_64-apple-darwin/stage1/bin/rustdoc --test test.rs

running 3 tests
test test.rs - line 13 ... ok
test test.rs - line 5 ... ok
test foo.rs - line 2 ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured
```

```

` ``
println!("lol");
` ``

asdjnfasd

asd
```

It displays:

```
./build/x86_64-apple-darwin/stage1/bin/rustdoc --test foo.md

running 1 test
test <input> - line 3 ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
```

r? @alexcrichton
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 8, 2017
…_file, r=alexcrichton

Display correct filename with --test option

Fixes rust-lang#39592.

With the current files:

```rust
pub mod foo;

/// This is a Foo;
///
/// ```
/// println!("baaaaaar");
/// ```
pub struct Foo;

/// This is a Bar;
///
/// ```
/// println!("fooooo");
/// ```
pub struct Bar;
```

```rust
// note the whitespaces
/// ```
/// println!("foo");
/// ```
pub fn foo() {}
```

It displays:

```
./build/x86_64-apple-darwin/stage1/bin/rustdoc --test test.rs

running 3 tests
test test.rs - line 13 ... ok
test test.rs - line 5 ... ok
test foo.rs - line 2 ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured
```

```

` ``
println!("lol");
` ``

asdjnfasd

asd
```

It displays:

```
./build/x86_64-apple-darwin/stage1/bin/rustdoc --test foo.md

running 1 test
test <input> - line 3 ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
```

r? @alexcrichton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants