squiggle/packages/squiggle-lang/__tests__/Reducer/Reducer_functionAssignment_test.res
Umur Ozkul 2e8e71bbd0 project
test

remove setResult

parse end of outerblock

test end of outer block

compiles

testing

bindings tested

todo chain bindings

topological sort
2022-08-10 11:53:39 +02:00

19 lines
485 B
Plaintext

open Jest
open Reducer_TestHelpers
describe("Parse function assignment", () => {
testParseToBe(
"f(x)=x",
"Ok({(:$_let_$ :f (:$$_lambda_$$ [x] {:x})); (:$_endOfOuterBlock_$ () ())})",
)
testParseToBe(
"f(x)=2*x",
"Ok({(:$_let_$ :f (:$$_lambda_$$ [x] {(:multiply 2 :x)})); (:$_endOfOuterBlock_$ () ())})",
)
//MathJs does not allow blocks in function definitions
})
describe("Evaluate function assignment", () => {
testEvalToBe("f(x)=x; f(1)", "Ok(1)")
})