Added unit test for negative number literals in macros.

This commit is contained in:
Tim 2020-10-06 22:11:18 +02:00
parent 8cf9362984
commit 27798ee575
No known key found for this signature in database
GPG Key ID: 6B6CB2B1860F1CBA

View File

@ -202,3 +202,24 @@ fn convert_leaf(leaf: &tt::Leaf) -> TtToken {
tt::Leaf::Punct(punct) => convert_punct(*punct),
}
}
#[cfg(test)]
mod tests {
use super::{convert_literal, TtToken};
use syntax::{SmolStr, SyntaxKind};
#[test]
fn test_negative_literal() {
assert_eq!(
convert_literal(&tt::Literal {
id: tt::TokenId::unspecified(),
text: SmolStr::new("-42.0")
}),
TtToken {
kind: SyntaxKind::FLOAT_NUMBER,
is_joint_to_next: false,
text: SmolStr::new("-42.0")
}
);
}
}