Skip to content

Add edge case tests for math parser number formats #9272

@coderabbitai

Description

@coderabbitai

Context

Follow-up to PR #9263 which replaced eval() with a safe math expression parser.

Requested by @christian-byrne in #9263 (comment)

Description

The math parser test suite should be extended to explicitly cover number format edge cases that are common gotchas in math parsers:

  • Trailing dot: 123. (should evaluate to 123)
  • Trailing dot in expression: 123.+3 (should evaluate to 126)
  • Lone dot: . (should return undefined)
  • Double dot: 123.. (should return undefined)

These edge cases are covered in expr-eval's test suite and would improve confidence in the parser's robustness.

Location

File: src/lib/litegraph/src/utils/mathParser.test.ts

References

┆Issue is synchronized with this Notion page by Unito

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions