cps-interpreter/test/parser.spec.ts

16 lines
447 B
TypeScript

import { expect, test } from 'bun:test';
import { TestPrograms } from './programs';
import { peggyParse } from '@/parser';
test('Primitive Operations', async () => {
const [operation] = peggyParse(await TestPrograms.AddOneThree);
const { primitiveOperation } = operation;
expect(primitiveOperation).toEqual({
opr: '+',
operands: [{ real: 1 }, { int: 3 }],
resultBindings: [{ name: 'result' }],
continuations: [],
});
});