ucg/integration_tests/selectors_test.ucg

53 lines
722 B
Plaintext

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";
|;
assert |
{foo = "bar"}.foo == "bar";
|;
assert |
["one", "two", "three"].0 == "one";
|;
let macro_for_test = macro() => {
foo = "bar",
};
assert |
macro_for_test().foo == "bar";
|;
let mymodule = module { foo = "bar" } => {
let foo = mod.foo;
};
assert |
mymodule{}.foo == "bar";
|;