ucg/std/tests/functional_test.ucg
Jeremy Wall 890387b4cc FEATURE: Macros are just an expression now.
This is a breaking change for the map, filter, and reduce expressions
but happily a forward compatible change for macros themselves.
2019-01-16 19:27:58 -06:00

29 lines
508 B
Plaintext

let t = (import "std/testing.ucg").asserts{};
let f = (import "std/functional.ucg");
let op = macro(arg) => arg{foo="bar"};
assert t.equal{
left = f.maybe{val=NULL}.do(op),
right = NULL,
};
assert t.equal{
left = f.maybe{val={}}.do(op),
right = {foo="bar"},
};
assert t.equal{
left = f.if{test=true}.do(op, {}),
right = {foo="bar"},
};
assert t.equal{
left = f.if{test=false}.do(op, {}),
right = {},
};
assert t.equal{
left = f.identity("foo"),
right = "foo",
};