aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorTim <[email protected]>2020-10-06 21:11:18 +0100
committerTim <[email protected]>2020-10-06 21:28:13 +0100
commit27798ee575a975a1806ced86aca8aea407897851 (patch)
treeba8f5239277b6e87576775d03ca6ce9fb0df181c /crates
parent8cf93629840aa0130abae003d1436040f1852144 (diff)
Added unit test for negative number literals in macros.
Diffstat (limited to 'crates')
-rw-r--r--crates/mbe/src/subtree_source.rs21
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)]
207mod 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}