mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Added unit test for negative number literals in macros.
This commit is contained in:
parent
8cf9362984
commit
27798ee575
1 changed files with 21 additions and 0 deletions
|
@ -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")
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue