mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
31 lines
561 B
Plaintext
31 lines
561 B
Plaintext
let t = (import "std/testing.ucg").asserts{};
|
|
let f = (import "std/functional.ucg");
|
|
|
|
let op = macro(arg) => {
|
|
result = arg{foo="bar"},
|
|
};
|
|
|
|
assert t.equal{
|
|
left = f.maybe{val=NULL}.do(op).result,
|
|
right = NULL,
|
|
};
|
|
|
|
assert t.equal{
|
|
left = f.maybe{val={}}.do(op).result,
|
|
right = {foo="bar"},
|
|
};
|
|
|
|
assert t.equal{
|
|
left = f.if{test=true}.do(op, {}).result,
|
|
right = {foo="bar"},
|
|
};
|
|
|
|
assert t.equal{
|
|
left = f.if{test=false}.do(op, {}).result,
|
|
right = {},
|
|
};
|
|
|
|
assert t.equal{
|
|
left = f.identity("foo").result,
|
|
right = "foo",
|
|
}; |