Skip to content

Commit e741b1d

Browse files
committed
Add test for argument with scientific notation
1 parent 579c630 commit e741b1d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/lex.rs

+27
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,33 @@ mod variable_lexer_tests {
11431143
);
11441144
}
11451145

1146+
#[test]
1147+
fn test_lex_numeric_argument_scientific() {
1148+
let variable = " foo.bar|default:5.2e3 ";
1149+
let lexer = VariableLexer::new(variable, 0);
1150+
let tokens: Vec<_> = lexer.collect();
1151+
assert_eq!(
1152+
tokens,
1153+
vec![
1154+
Ok(VariableToken {
1155+
token_type: VariableTokenType::Variable,
1156+
content: "foo.bar",
1157+
at: (3, 10),
1158+
}),
1159+
Ok(VariableToken {
1160+
token_type: VariableTokenType::Filter,
1161+
content: "default",
1162+
at: (11, 18),
1163+
}),
1164+
Ok(VariableToken {
1165+
token_type: VariableTokenType::Numeric,
1166+
content: "5.2e3",
1167+
at: (19, 24),
1168+
}),
1169+
]
1170+
);
1171+
}
1172+
11461173
#[test]
11471174
fn test_lex_variable_argument() {
11481175
let variable = " foo.bar|default:spam ";

0 commit comments

Comments
 (0)