20 lines
511 B
TypeScript
20 lines
511 B
TypeScript
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]);
|
|
});
|
|
});
|
|
|