2022-04-28 16:35:09 +00:00
|
|
|
// TODO: Reimplement with usual parse
|
2022-04-17 17:24:39 +00:00
|
|
|
open Jest
|
|
|
|
open Reducer_TestHelpers
|
|
|
|
|
2022-04-21 17:48:07 +00:00
|
|
|
describe("Eval with Bindings", () => {
|
2022-04-21 22:02:27 +00:00
|
|
|
testEvalBindingsToBe("x", list{("x", ExpressionValue.EvNumber(1.))}, "Ok(1)")
|
|
|
|
testEvalBindingsToBe("x+1", list{("x", ExpressionValue.EvNumber(1.))}, "Ok(2)")
|
2022-05-20 15:11:32 +00:00
|
|
|
testParseToBe("y = x+1; y", "Ok((:$$_block_$$ (:$_let_$ :y (:$$_block_$$ (:add :x 1))) :y))")
|
2022-04-21 22:02:27 +00:00
|
|
|
testEvalBindingsToBe("y = x+1; y", list{("x", ExpressionValue.EvNumber(1.))}, "Ok(2)")
|
2022-04-29 16:14:02 +00:00
|
|
|
testEvalBindingsToBe("y = x+1", list{("x", ExpressionValue.EvNumber(1.))}, "Ok({x: 1,y: 2})")
|
2022-04-21 17:28:29 +00:00
|
|
|
})
|