47 lines
813 B
JavaScript
47 lines
813 B
JavaScript
import assert from "node:assert";
|
||
import { getDefaultTypeParser }from "../lib/parser/type_parser.js";
|
||
import { prettyT } from "../lib/util/pretty.js";
|
||
|
||
const parse = getDefaultTypeParser();
|
||
|
||
assert.equal(
|
||
// actual
|
||
prettyT(parse("Int")),
|
||
// expected
|
||
"Int",
|
||
);
|
||
|
||
assert.equal(
|
||
// actual
|
||
prettyT(parse("Int * Bool")),
|
||
// expected
|
||
"(Int ⨯ Bool)",
|
||
);
|
||
|
||
assert.equal(
|
||
// actual
|
||
prettyT(parse("(((((((Int)))) => ((Bool)))))")),
|
||
// expected
|
||
"(Int => Bool)",
|
||
);
|
||
|
||
assert.equal(
|
||
// actual
|
||
prettyT(parse("#0((Int * #0) + Unit)")),
|
||
// expected
|
||
"#0((Int ⨯ #0) + Unit)",
|
||
);
|
||
|
||
assert.equal(
|
||
// actual
|
||
prettyT(parse("#0((a * #0) + Unit")),
|
||
// expected
|
||
"#0((a ⨯ #0) + Unit)",
|
||
);
|
||
|
||
assert.equal(
|
||
// actual
|
||
prettyT(parse("(a*b) + (c*d)")),
|
||
// expected
|
||
"((a ⨯ b) + (c ⨯ d))",
|
||
);
|