Skip to content

cargo check --tests not working #4330

Closed
@davemilter

Description

@davemilter

cargo check --help tells

--tests Check all tests

I expect that at least it cheks syntax of tests.
I created simple project cargo new foo,
and edit src/lib.rs like this:

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        baguaga
    }
}

I run cargo check --tests (cargo 0.22.0-nightly (88aa6423a 2017-07-22)) and
it reports nothing:

$ cargo check --tests
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
$ cargo test
   Compiling foo v0.1.0 (file:///tmp/foo)
error[E0425]: cannot find value `baguaga` in this scope
 --> src/lib.rs:5:9
  |
5 |         baguaga
  |         ^^^^^^^ not found in this scope

error: aborting due to previous error

error: Could not compile `foo`.

To learn more, run the command again with --verbose.

I expected the same error report from cargo check --tests as from cargo test
foo directory in attachment.
foo.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions