Skip to content

Commit 4b505ce

Browse files
committed
internal: Add token mapping test for float literals
1 parent d121307 commit 4b505ce

File tree

1 file changed

+50
-0
lines changed
  • crates/hir-def/src/macro_expansion_tests

1 file changed

+50
-0
lines changed

crates/hir-def/src/macro_expansion_tests/mbe.rs

+50
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,56 @@ struct#10 MyTraitMap2#32 {#13
4646
);
4747
}
4848

49+
#[test]
50+
fn token_mapping_floats() {
51+
check(
52+
r#"
53+
// +tokenids
54+
macro_rules! f {
55+
($($tt:tt)*) => {
56+
$($tt)*
57+
};
58+
}
59+
60+
// +tokenids
61+
f! {
62+
fn main() {
63+
1;
64+
1.0;
65+
let x = 1;
66+
}
67+
}
68+
69+
70+
"#,
71+
expect![[r##"
72+
// call ids will be shifted by Shift(18)
73+
// +tokenids
74+
macro_rules! f {#0
75+
(#1$#2(#3$#4tt#5:#6tt#7)#3*#8)#1 =#9>#10 {#11
76+
$#12(#13$#14tt#15)#13*#16
77+
}#11;#17
78+
}#0
79+
80+
// // +tokenids
81+
// f! {
82+
// fn#1 main#2() {
83+
// 1#5;#6
84+
// 1.0#7;#8
85+
// let#9 x#10 =#11 1#12;#13
86+
// }
87+
// }
88+
fn#19 main#20(#21)#21 {#22
89+
1#23;#24
90+
1#26.0;
91+
let x#31 =#22 1;
92+
}
93+
94+
95+
"##]],
96+
);
97+
}
98+
4999
#[test]
50100
fn mbe_smoke_test() {
51101
check(

0 commit comments

Comments
 (0)