thp-lang.org/lexer/number_lexer.test.ts

20 lines
511 B
TypeScript
Raw Normal View History

2024-03-26 23:05:58 +00:00
import { expect, test, describe } from "bun:test";
import { lex_number } from "./number_lexer";
describe("Number Lexer", () => {
test("should return a whole number token", () => {
const code = "1";
const token = lex_number(code, 0);
expect(token).toEqual([{ v: "1" }, 1]);
});
test("should return a whole number token pt 2", () => {
const code = "12345";
const token = lex_number(code, 0);
expect(token).toEqual([{ v: "12345" }, 5]);
});
});