ucg/integration_tests/macros_test.ucg
Jeremy Wall d2f0ea9f24 FEATURE: Better error reporting.
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.
2018-11-06 19:40:56 -06:00

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;
|;