Skip to content

Commit ad4b02e

Browse files
committed
add automated semicolon insertion test
1 parent 3f5fc05 commit ad4b02e

File tree

1 file changed

+28
-0
lines changed
  • crates/hir_def/src/macro_expansion_tests

1 file changed

+28
-0
lines changed

crates/hir_def/src/macro_expansion_tests/mbe.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,34 @@ fn baz() {
299299
)
300300
}
301301

302+
#[test]
303+
fn asi() {
304+
// Thanks, Christopher!
305+
//
306+
// https://internals.rust-lang.org/t/understanding-decisions-behind-semicolons/15181/29
307+
check(
308+
r#"
309+
macro_rules! asi { ($($stmt:stmt)*) => ($($stmt)*); }
310+
311+
fn main() {
312+
asi! {
313+
let a = 2
314+
let b = 5
315+
drop(b-a)
316+
println!("{}", a+b)
317+
}
318+
}
319+
"#,
320+
expect![[r#"
321+
macro_rules! asi { ($($stmt:stmt)*) => ($($stmt)*); }
322+
323+
fn main() {
324+
let a = 2let b = 5drop(b-a)println!("{}", a+b)
325+
}
326+
"#]],
327+
)
328+
}
329+
302330
#[test]
303331
fn test_match_group_empty_fixed_token() {
304332
check(

0 commit comments

Comments
 (0)