ucg/std/tests/functional_test.ucg

29 lines
508 B
Plaintext
Raw Normal View History

let t = (import "std/testing.ucg").asserts{};
let f = (import "std/functional.ucg");
let op = func (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",
};