the next generation of the in-browser educational proof assistant
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clean .mjs files

Josh Brown cf5bcc33 0437f7a2

+1 -142
+1
.gitignore
··· 27 27 .bsb.lock 28 28 **/*.res.mjs 29 29 src/*.mjs 30 + tests/*.mjs
-108
tests/SExpTest.mjs
··· 1 - // Generated by ReScript, PLEASE EDIT WITH CARE 2 - 3 - import * as SExp from "../src/SExp.mjs"; 4 - import * as Zora from "zora"; 5 - import * as TestUtil from "./TestUtil.mjs"; 6 - 7 - var Util = TestUtil.MakeTerm(SExp); 8 - 9 - Zora.test("parse symbol", (function (t) { 10 - t.test("single char", (function (t) { 11 - Util.testParse(t, "x", { 12 - TAG: "Symbol", 13 - name: "x" 14 - }, undefined); 15 - })); 16 - t.test("multi char", (function (t) { 17 - Util.testParse(t, "xyz", { 18 - TAG: "Symbol", 19 - name: "xyz" 20 - }, undefined); 21 - })); 22 - })); 23 - 24 - Zora.test("parse var", (function (t) { 25 - t.test("single digit", (function (t) { 26 - Util.testParse(t, "\\1", { 27 - TAG: "Var", 28 - idx: 1 29 - }, undefined); 30 - })); 31 - t.test("multi digit", (function (t) { 32 - Util.testParse(t, "\\234", { 33 - TAG: "Var", 34 - idx: 234 35 - }, undefined); 36 - })); 37 - })); 38 - 39 - Zora.test("parse schematic", (function (t) { 40 - t.test("empty allowed", (function (t) { 41 - Util.testParse(t, "?1()", { 42 - TAG: "Schematic", 43 - schematic: 1, 44 - allowed: [] 45 - }, undefined); 46 - })); 47 - t.test("one allowed", (function (t) { 48 - Util.testParse(t, "?1(\\1)", { 49 - TAG: "Schematic", 50 - schematic: 1, 51 - allowed: [1] 52 - }, undefined); 53 - })); 54 - t.test("multiple allowed", (function (t) { 55 - Util.testParse(t, "?1(\\1 \\23 \\4)", { 56 - TAG: "Schematic", 57 - schematic: 1, 58 - allowed: [ 59 - 1, 60 - 2, 61 - 4 62 - ] 63 - }, undefined); 64 - })); 65 - })); 66 - 67 - Zora.test("parse compound", (function (t) { 68 - t.test("unit", (function (t) { 69 - Util.testParse(t, "()", { 70 - TAG: "Compound", 71 - subexps: [] 72 - }, undefined); 73 - })); 74 - t.test("single", (function (t) { 75 - Util.testParse(t, "(a)", { 76 - TAG: "Compound", 77 - subexps: [{ 78 - TAG: "Symbol", 79 - name: "a" 80 - }] 81 - }, undefined); 82 - })); 83 - t.test("multiple", (function (t) { 84 - Util.testParse(t, "(a \\1 ?1())", { 85 - TAG: "Compound", 86 - subexps: [ 87 - { 88 - TAG: "Symbol", 89 - name: "a" 90 - }, 91 - { 92 - TAG: "Var", 93 - idx: 1 94 - }, 95 - { 96 - TAG: "Schematic", 97 - schematic: 1, 98 - allowed: [] 99 - } 100 - ] 101 - }, undefined); 102 - })); 103 - })); 104 - 105 - export { 106 - Util , 107 - } 108 - /* Util Not a pure module */
-34
tests/TestUtil.mjs
··· 1 - // Generated by ReScript, PLEASE EDIT WITH CARE 2 - 3 - import * as Caml_option from "rescript/lib/es6/caml_option.js"; 4 - import * as Core__Option from "@rescript/core/src/Core__Option.mjs"; 5 - 6 - function stringifyExn(t) { 7 - return Core__Option.getExn(JSON.stringify(t, undefined, 2), undefined); 8 - } 9 - 10 - function MakeTerm(Term) { 11 - var termEquivalent = function (t, t1, t2, msg) { 12 - t.ok(Term.equivalent(t1, t2), Core__Option.getOr(msg, stringifyExn(t1) + " equivalent to " + stringifyExn(t2))); 13 - }; 14 - var testParse = function (t, input, t2, msg) { 15 - var res = Term.parse(input, [], Caml_option.some(Term.makeGen())); 16 - if (res.TAG === "Ok") { 17 - var res$1 = res._0; 18 - t.equal(res$1[1], "", input + " input consumed"); 19 - t.equal(res$1[0], t2, msg !== undefined ? Caml_option.valFromOption(msg) : undefined); 20 - return ; 21 - } 22 - t.fail("parse failed: " + res._0); 23 - }; 24 - return { 25 - termEquivalent: termEquivalent, 26 - testParse: testParse 27 - }; 28 - } 29 - 30 - export { 31 - stringifyExn , 32 - MakeTerm , 33 - } 34 - /* No side effect */