Added unit test for negative number literals in macros.
This commit is contained in:
@@ -202,3 +202,24 @@ fn convert_leaf(leaf: &tt::Leaf) -> TtToken {
|
|||||||
tt::Leaf::Punct(punct) => convert_punct(*punct),
|
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")
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user