From def86eed2057ea18051d2d3e80b988ffb773f200 Mon Sep 17 00:00:00 2001 From: Pavlos Rontidis Date: Fri, 6 Dec 2024 14:13:53 -0500 Subject: [PATCH] fix(stdlib): fix typo in parse_float and add one test case --- src/stdlib/parse_float.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/stdlib/parse_float.rs b/src/stdlib/parse_float.rs index f83c8c3a29..bc3a89d8e8 100644 --- a/src/stdlib/parse_float.rs +++ b/src/stdlib/parse_float.rs @@ -54,16 +54,16 @@ impl Function for ParseFloat { ) -> Compiled { let value = arguments.required("value"); - Ok(ParseIntFn { value }.as_expr()) + Ok(ParseFloatFn { value }.as_expr()) } } #[derive(Debug, Clone)] -struct ParseIntFn { +struct ParseFloatFn { value: Box, } -impl FunctionExpression for ParseIntFn { +impl FunctionExpression for ParseFloatFn { fn resolve(&self, ctx: &mut Context) -> Resolved { let value = self.value.resolve(ctx)?; @@ -147,5 +147,11 @@ mod tests { want: Ok(f64::MAX), tdef: TypeDef::float().fallible(), } + + large_string { + args: func_args![value: "9".repeat(9999)], + want: Ok(f64::INFINITY), + tdef: TypeDef::float().fallible(), + } ]; }