Cargo version: cargo 0.19.0-nightly (fa7584c14 2017-04-26)
cargo check --tests and cargo build --tests seem to ignore semantic errors in tests.
I don't know if that's intentional, but it's frustrating to be unable to cargo check code in my tests properly.
Examples:
Common Cargo.toml
[package]
name = "check_test"
version = "0.1.0"
authors = ["me"]
[dependencies]
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
asset_eq!(1, 1); // intentional typo (semantic error)
}
}
What happens: running cargo check --lib --tests completes with no errors (code 0)
What should happen: running cargo check --lib --tests should indicate:
cannot find macro `asset_eq!` in this scope
help: did you mean `assert_eq!`?
fn not_a_test() {
asset_eq!(1, 1); // intentional typo (semantic error)
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
}
}
What happens AND should happen: running cargo check --lib --tests indicates:
cannot find macro `asset_eq!` in this scope
help: did you mean `assert_eq!`?
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
i'm syntaxically incorrect code
}
}
What happens AND should happen: running cargo check --lib --tests (actually cargo check gives the same output, so I think that syntax is checked regardless of cargo filters) indicates:
message: 'expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `'m`
label: expected one of 8 possible tokens here'
Cargo version:
cargo 0.19.0-nightly (fa7584c14 2017-04-26)cargo check --testsandcargo build --testsseem to ignore semantic errors in tests.I don't know if that's intentional, but it's frustrating to be unable to
cargo checkcode in my tests properly.Examples:
Common
Cargo.tomlsrc/lib.rsexample 1What happens: running
cargo check --lib --testscompletes with no errors (code 0)What should happen: running
cargo check --lib --testsshould indicate:src/lib.rsexample 2What happens AND should happen: running
cargo check --lib --testsindicates:src/lib.rsexample 3What happens AND should happen: running
cargo check --lib --tests(actuallycargo checkgives the same output, so I think that syntax is checked regardless of cargo filters) indicates: