From 4b505ce0f998490cc0979fa72c5be6425da15843 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 12 May 2022 13:17:53 +0200 Subject: [PATCH] internal: Add token mapping test for float literals --- .../hir-def/src/macro_expansion_tests/mbe.rs | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/crates/hir-def/src/macro_expansion_tests/mbe.rs b/crates/hir-def/src/macro_expansion_tests/mbe.rs index c8c7b19acaa..8e019204832 100644 --- a/crates/hir-def/src/macro_expansion_tests/mbe.rs +++ b/crates/hir-def/src/macro_expansion_tests/mbe.rs @@ -46,6 +46,56 @@ macro_rules! f {#0 ); } +#[test] +fn token_mapping_floats() { + check( + r#" +// +tokenids +macro_rules! f { + ($($tt:tt)*) => { + $($tt)* + }; +} + +// +tokenids +f! { + fn main() { + 1; + 1.0; + let x = 1; + } +} + + +"#, + expect![[r##" +// call ids will be shifted by Shift(18) +// +tokenids +macro_rules! f {#0 + (#1$#2(#3$#4tt#5:#6tt#7)#3*#8)#1 =#9>#10 {#11 + $#12(#13$#14tt#15)#13*#16 + }#11;#17 +}#0 + +// // +tokenids +// f! { +// fn#1 main#2() { +// 1#5;#6 +// 1.0#7;#8 +// let#9 x#10 =#11 1#12;#13 +// } +// } +fn#19 main#20(#21)#21 {#22 + 1#23;#24 + 1#26.0; + let x#31 =#22 1; +} + + +"##]], + ); +} + #[test] fn mbe_smoke_test() { check(