mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
Added unit test for negative number literals in macros.
This commit is contained in:
parent
8cf9362984
commit
27798ee575
@ -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")
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user