diff --git a/packages/squiggle-lang/__tests__/Reducer/Reducer_MathJs/Reducer_MathJsParse_test.res b/packages/squiggle-lang/__tests__/Reducer/Reducer_MathJs/Reducer_MathJsParse_test.res index 4acfc1c1..4e67f3d6 100644 --- a/packages/squiggle-lang/__tests__/Reducer/Reducer_MathJs/Reducer_MathJsParse_test.res +++ b/packages/squiggle-lang/__tests__/Reducer/Reducer_MathJs/Reducer_MathJsParse_test.res @@ -7,32 +7,38 @@ open Expect let expectParseToBe = (expr, answer) => Parse.parse(expr)->Result.flatMap(Parse.castNodeType)->Parse.toStringResult->expect->toBe(answer) +let testParse = (expr, answer) => + test(expr, () => expectParseToBe(expr, answer)) + +let skipTestParse = (expr, answer) => + Skip.test(expr, () => expectParseToBe(expr, answer)) + describe("MathJs parse", () => { describe("literals operators paranthesis", () => { - test("1", () => expectParseToBe("1", "1")) - test("'hello'", () => expectParseToBe("'hello'", "'hello'")) - test("true", () => expectParseToBe("true", "true")) - test("1+2", () => expectParseToBe("1+2", "add(1, 2)")) - test("add(1,2)", () => expectParseToBe("add(1,2)", "add(1, 2)")) - test("(1)", () => expectParseToBe("(1)", "(1)")) - test("(1+2)", () => expectParseToBe("(1+2)", "(add(1, 2))")) + testParse("1", "1") + testParse("'hello'", "'hello'") + testParse("true", "true") + testParse("1+2", "add(1, 2)") + testParse("add(1,2)", "add(1, 2)") + testParse("(1)", "(1)") + testParse("(1+2)", "(add(1, 2))") }) describe("variables", () => { - Skip.test("define", () => expectParseToBe("x = 1", "???")) - Skip.test("use", () => expectParseToBe("x", "???")) + skipTestParse("x = 1", "???") + skipTestParse("x", "???") }) describe("functions", () => { - Skip.test("define", () => expectParseToBe("identity(x) = x", "???")) - Skip.test("use", () => expectParseToBe("identity(x)", "???")) + skipTestParse("identity(x) = x", "???") + skipTestParse("identity(x)", "???") }) describe("arrays", () => { test("empty", () => expectParseToBe("[]", "[]")) test("define", () => expectParseToBe("[0, 1, 2]", "[0, 1, 2]")) test("define with strings", () => expectParseToBe("['hello', 'world']", "['hello', 'world']")) - Skip.test("range", () => expectParseToBe("range(0, 4)", "range(0, 4)")) + skipTestParse("range(0, 4)", "range(0, 4)") test("index", () => expectParseToBe("([0,1,2])[1]", "([0, 1, 2])[1]")) })