diff options
Diffstat (limited to 'crates/mbe/src/subtree_source.rs')
-rw-r--r-- | crates/mbe/src/subtree_source.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/mbe/src/subtree_source.rs b/crates/mbe/src/subtree_source.rs index 8941da0f1..226dc3bec 100644 --- a/crates/mbe/src/subtree_source.rs +++ b/crates/mbe/src/subtree_source.rs | |||
@@ -202,3 +202,24 @@ fn convert_leaf(leaf: &tt::Leaf) -> TtToken { | |||
202 | tt::Leaf::Punct(punct) => convert_punct(*punct), | 202 | tt::Leaf::Punct(punct) => convert_punct(*punct), |
203 | } | 203 | } |
204 | } | 204 | } |
205 | |||
206 | #[cfg(test)] | ||
207 | mod tests { | ||
208 | use super::{convert_literal, TtToken}; | ||
209 | use syntax::{SmolStr, SyntaxKind}; | ||
210 | |||
211 | #[test] | ||
212 | fn test_negative_literal() { | ||
213 | assert_eq!( | ||
214 | convert_literal(&tt::Literal { | ||
215 | id: tt::TokenId::unspecified(), | ||
216 | text: SmolStr::new("-42.0") | ||
217 | }), | ||
218 | TtToken { | ||
219 | kind: SyntaxKind::FLOAT_NUMBER, | ||
220 | is_joint_to_next: false, | ||
221 | text: SmolStr::new("-42.0") | ||
222 | } | ||
223 | ); | ||
224 | } | ||
225 | } | ||