Lambda calculus-like library written in TypeScript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
jlc/test/core.spec.ts

18 lines
570 B

import { describe, expect, it } from '@jest/globals';
import { _, cnst, fromNative, id, toNative, undef } from '../src/core';
describe('id', () => {
it('returns first argument', () => {
expect(toNative(id._(fromNative('first')))).toBe('first');
});
});
describe('cnst', () => {
it('returns first argument after receiving second', () => {
expect(toNative(cnst._(fromNative('first'))._(fromNative('second')))).toBe('first');
});
it('ignores second argument', () => {
expect(toNative(cnst._(fromNative('first'))._(undef))).toBe('first');
});
});