ciad/test/parser.test.ts

10 lines
643 B
TypeScript
Raw Permalink Normal View History

2024-09-14 06:39:00 +00:00
import { test, expect } from "bun:test";
import { stmt } from "../src/parser";
2024-09-14 06:15:42 +00:00
2024-09-14 06:39:00 +00:00
test("ifx", () => expect(stmt("ifx")).toMatchObject({ status: "ok", value: { expr: {} }, remain: "" }));
test("ifx:", () => expect(stmt("ifx:")).toMatchObject({ status: "ok", value: { expr: {} }, remain: ":" }));
test("if x:", () => expect(stmt("if x:")).toMatchObject({ status: "ok", value: { stmt: "if" }, remain: "" }));
test("if(x):", () => expect(stmt("if(x):")).toMatchObject({ status: "ok", value: { stmt: "if" }, remain: "" }));
// test("let let = let", () => expect(stmt("let let = let")).toMatchObject({status:"ok", value: {stmt: "let"}, remain: ""}))