diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs index 2a4343b0a..f75e321c3 100644 --- a/crates/ra_syntax/src/parsing/lexer.rs +++ b/crates/ra_syntax/src/parsing/lexer.rs | |||
@@ -145,3 +145,16 @@ pub fn classify_literal(text: &str) -> Option<Token> { | |||
145 | }; | 145 | }; |
146 | Some(Token { kind, len: TextUnit::from_usize(t.len) }) | 146 | Some(Token { kind, len: TextUnit::from_usize(t.len) }) |
147 | } | 147 | } |
148 | |||
149 | #[cfg(test)] | ||
150 | mod tests { | ||
151 | use super::*; | ||
152 | |||
153 | #[test] | ||
154 | fn lex_float_literal() { | ||
155 | assert_eq!( | ||
156 | tokenize("42f64")[0], | ||
157 | Token { kind: FLOAT_NUMBER, len: TextUnit::from_usize(5)} | ||
158 | ); | ||
159 | } | ||
160 | } \ No newline at end of file | ||