mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-23 18:29:50 -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.
36 lines
791 B
Plaintext
36 lines
791 B
Plaintext
let list1 = [1, 2, 3, 4];
|
|
let list2 = ["foo", "bar", "foo", "bar"];
|
|
|
|
let mapper = macro(item) => { result = item + 1 };
|
|
let filtrator = macro(item) => {
|
|
result = select item, NULL, {
|
|
foo = item,
|
|
},
|
|
};
|
|
|
|
let boolfiltrator = macro(item) => {
|
|
result = item < 5,
|
|
};
|
|
|
|
assert |
|
|
map mapper.result list1 == [2, 3, 4, 5];
|
|
|;
|
|
assert |
|
|
(map mapper.result [1, 2, 3, 4]) == [2, 3, 4, 5];
|
|
|;
|
|
assert |
|
|
map mapper.result [1, 2, 3, 4] == [2, 3, 4, 5];
|
|
|;
|
|
|
|
assert |
|
|
filter filtrator.result list2 == ["foo", "foo"];
|
|
|;
|
|
assert |
|
|
(filter filtrator.result ["foo", "bar", "foo", "bar"]) == ["foo", "foo"];
|
|
|;
|
|
assert |
|
|
filter filtrator.result ["foo", "bar", "foo", "bar"] == ["foo", "foo"];
|
|
|;
|
|
assert |
|
|
filter boolfiltrator.result [1, 2, 3, 4, 5, 6, 7] == [1, 2, 3, 4];
|
|
|; |