rust/src/test/ui/macros/assert-trailing-junk.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
619 B
Rust
Raw Normal View History

// Ensure assert macro does not ignore trailing garbage.
//
// See https://github.com/rust-lang/rust/issues/60024 for details.
fn main() {
assert!(true some extra junk, "whatever");
//~^ ERROR expected one of
assert!(true some extra junk);
//~^ ERROR expected one of
assert!(true, "whatever" blah);
//~^ ERROR no rules expected
2019-04-24 17:44:28 -05:00
assert!(true "whatever" blah);
//~^ ERROR unexpected string literal
2019-04-24 17:44:28 -05:00
//~^^ ERROR no rules expected
assert!(true;);
//~^ ERROR macro requires an expression
2019-04-24 17:44:28 -05:00
assert!(false || true "error message");
//~^ ERROR unexpected string literal
}