314dbc7f22
The parser already does a check-only unescaping which catches all errors. So the checking done in `from_token_lit` never hits. But literals causing warnings can still occur in `from_token_lit`. So the commit changes `str-escape.rs` to use byte string literals and C string literals as well, to give better coverage and ensure the new assertions in `from_token_lit` are correct.
33 lines
691 B
Rust
33 lines
691 B
Rust
// check-pass
|
||
// ignore-tidy-tab
|
||
// edition: 2021
|
||
|
||
fn main() {
|
||
let s = "\
|
||
|
||
";
|
||
//~^^^ WARNING multiple lines skipped by escaped newline
|
||
assert_eq!(s, "");
|
||
|
||
let s = c"foo\
|
||
bar
|
||
";
|
||
//~^^^ WARNING whitespace symbol '\u{a0}' is not skipped
|
||
assert_eq!(s, c"foo bar\n ");
|
||
|
||
let s = "a\
|
||
b";
|
||
assert_eq!(s, "ab");
|
||
|
||
let s = "a\
|
||
b";
|
||
assert_eq!(s, "ab");
|
||
|
||
let s = b"a\
|
||
b";
|
||
//~^^ WARNING whitespace symbol '\u{c}' is not skipped
|
||
// '\x0c' is ASCII whitespace, but it may not need skipped
|
||
// discussion: https://github.com/rust-lang/rust/pull/108403
|
||
assert_eq!(s, b"a\x0cb");
|
||
}
|