@informalsystems/quint
Version:
Core tool for the Quint specification language
26 lines • 1.32 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const mocha_1 = require("mocha");
const chai_1 = require("chai");
const quintTypes_1 = require("../../src/ir/quintTypes");
const parser_1 = require("../../src/types/parser");
(0, mocha_1.describe)('typeNames', () => {
(0, mocha_1.it)('find names in types', () => {
const result = (0, quintTypes_1.typeNames)((0, parser_1.parseTypeOrThrow)('(Set[a]) => List[b] -> { f1: c | r }'));
chai_1.assert.sameDeepMembers(Array.from(result.typeVariables), ['a', 'b', 'c']);
chai_1.assert.sameDeepMembers(Array.from(result.rowVariables), ['r']);
});
});
(0, mocha_1.describe)('operator types', () => {
(0, mocha_1.it)('support annotations with single, unbracketed param type', () => {
// Regression test for https://github.com/informalsystems/quint/issues/455
const result = (0, parser_1.parseType)('int => str');
(0, chai_1.assert)(result.isRight());
result.map(t => (0, chai_1.assert)(t.kind === 'oper'));
if (result.isRight() && result.value.kind === 'oper') {
chai_1.assert.deepEqual(result.value.args.map(t => t.kind), ['int']);
chai_1.assert.deepEqual(result.value.res.kind, 'str');
}
});
});
//# sourceMappingURL=quintTypes.test.js.map