Skip to content

Commit

Permalink
fix(stdlib): fix typo in parse_float and add one test case
Browse files Browse the repository at this point in the history
  • Loading branch information
pront committed Dec 6, 2024
1 parent c9873ff commit def86ee
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/stdlib/parse_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn Expression>,
}

impl FunctionExpression for ParseIntFn {
impl FunctionExpression for ParseFloatFn {
fn resolve(&self, ctx: &mut Context) -> Resolved {
let value = self.value.resolve(ctx)?;

Expand Down Expand Up @@ -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(),
}
];
}

0 comments on commit def86ee

Please sign in to comment.