mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 01:02:01 +03:00
Merge c0133101d7 into 37cfd2144b
This commit is contained in:
commit
519a64b6b3
1 changed files with 19 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import { describe, it, expect } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import { lexLine } from "./lexer";
|
import { lexLine, lexPhrase } from "./lexer";
|
||||||
import { Decimal } from "./types";
|
import { Decimal } from "./types";
|
||||||
|
|
||||||
describe("lexer", () => {
|
describe("lexer", () => {
|
||||||
|
|
@ -110,4 +110,22 @@ describe("lexer", () => {
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("lexPhrase", () => {
|
||||||
|
it("should split a phrase into raw strings", () => {
|
||||||
|
expect(lexPhrase("meters per second")).toEqual(["meters", "per", "second"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should handle empty strings", () => {
|
||||||
|
expect(lexPhrase("")).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should ignore extra spaces", () => {
|
||||||
|
expect(lexPhrase(" meters per second ")).toEqual(["meters", "per", "second"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should handle symbols correctly", () => {
|
||||||
|
expect(lexPhrase("meters / second")).toEqual(["meters", "/", "second"]);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue