mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-21 18:10:42 -04:00
46 lines
808 B
Plaintext
46 lines
808 B
Plaintext
let noargmacro = macro() => {
|
|
field1 = "value",
|
|
};
|
|
|
|
let simplemacro = macro(arg1, arg2, arg3) => {
|
|
field1 = arg1,
|
|
field2 = arg2,
|
|
field3 = arg3,
|
|
};
|
|
|
|
let cplxmacro = macro(argint, argstr, argfloat) => {
|
|
field1 = argint + 1,
|
|
field2 = argstr + " are here",
|
|
field3 = argfloat - 1.0,
|
|
boolfield = argint == 1,
|
|
};
|
|
|
|
let noargresult = noargmacro();
|
|
let simpleresult = simplemacro(1, 2, 3);
|
|
let cplxresult = cplxmacro(1, "We", 3.0);
|
|
|
|
assert |
|
|
noargresult.field1 == "value";
|
|
|;
|
|
assert |
|
|
simpleresult.field1 == 1;
|
|
|;
|
|
assert |
|
|
simpleresult.field2 == 2;
|
|
|;
|
|
assert |
|
|
simpleresult.field3 == 3;
|
|
|;
|
|
|
|
assert |
|
|
cplxresult.field1 == 2;
|
|
|;
|
|
assert |
|
|
cplxresult.field2 == "We are here";
|
|
|;
|
|
assert |
|
|
cplxresult.field3 == 2.0;
|
|
|;
|
|
assert |
|
|
cplxresult.boolfield == true;
|
|
|; |