Skip to content

Unnecessary whitespaces in test stdout capture #50362

Closed
@Vlad-Shcherbina

Description

@Vlad-Shcherbina

To reproduce, run cargo test on the following library:

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        println!("hello");
        println!("world");
        panic!();
    }
}

Expected output:

...
---- tests::it_works stdout ----
hello
world
thread 'tests::it_works' panicked at 'explicit panic', src\lib.rs:7:9
...

Actual output:

...
---- tests::it_works stdout ----
        hello
world
thread 'tests::it_works' panicked at 'explicit panic', src\lib.rs:7:9
...

Version info:

> rustc --version --verbose
rustc 1.26.0-nightly (5508b2714 2018-03-18)
binary: rustc
commit-hash: 5508b27145cfb82896ae838e6aca0cd48750796f
commit-date: 2018-03-18
host: x86_64-pc-windows-msvc
release: 1.26.0-nightly
LLVM version: 6.0

> cargo --version --verbose
cargo 1.26.0-nightly (d6c3983fe 2018-03-16)
release: 1.26.0
commit-hash: d6c3983fe3bd8fa06b54712e53fb23645598188b
commit-date: 2018-03-16

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` libraryC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions