mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
Slight change to how assert works to support this. We no longer automatically add a semicolon to the expressions we require the user to right them. This updates the docs to illustrate that and reformats our integration test suite for this and readability.
38 lines
673 B
Plaintext
38 lines
673 B
Plaintext
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 simpleresult = simplemacro(1, 2, 3);
|
|
let cplxresult = cplxmacro(1, "We", 3.0);
|
|
|
|
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;
|
|
|; |