mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-21 18:10:42 -04:00
TESTS: Add some integration tests.
This commit is contained in:
parent
734bf01385
commit
cb31ec8e31
22
integration_tests/macros_test.ucg
Normal file
22
integration_tests/macros_test.ucg
Normal file
@ -0,0 +1,22 @@
|
||||
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,
|
||||
};
|
||||
|
||||
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";
|
19
integration_tests/selectors_test.ucg
Normal file
19
integration_tests/selectors_test.ucg
Normal file
@ -0,0 +1,19 @@
|
||||
let list = [1, 2, 3, 4];
|
||||
|
||||
let tuple = {
|
||||
field1 = list.0,
|
||||
field2 = list.2,
|
||||
deeplist = ["foo", "bar"],
|
||||
};
|
||||
|
||||
let testmacro = macro(arg) => {
|
||||
output = arg,
|
||||
};
|
||||
|
||||
assert "list.0 == 1";
|
||||
assert "list.1 == 2";
|
||||
assert "list.3 == 4";
|
||||
assert "tuple.field1 == 1";
|
||||
assert "tuple.field2 == 3";
|
||||
assert "tuple.deeplist.0 == \"foo\"";
|
||||
assert "tuple.deeplist.1 == \"bar\"";
|
Loading…
x
Reference in New Issue
Block a user