cases:
- note: basic
data: {}
modules:
- |
package test
array = [1, 2, 3]
nested_array = [1, [2, 3, 4], 5, 6]
object = { "key0": "value0" }
key = "key"
object_var = { key: array }
local_0 = x {
x = 10
}
local_1 = x {
x = "test_local"
}
# Set with nested object, array and set.
set = { 1, 2,
{"a": 3, "b" : 4}, [5, 6], {7, 8}}
# Object with non-string as keys
complex_object = {
{1, 2, 3} : [4, 5, 6],
true: false,
[1, 3] : {"hello", "world"}
}
query: data.test
want_result:
array: [1, 2, 3]
nested_array: [1, [2, 3, 4], 5, 6]
object:
key0: value0
key: key
object_var:
key: [1, 2, 3]
local_0: 10
local_1: test_local
set:
set!:
- 2
- 1
- a : 3
b : 4
- [5, 6]
- set!: [8, 7]
complex_object:
object!:
- key:
set!: [3, 2, 1]
value: [4, 5, 6]
- key: true
value: false
- key: [1, 3]
value:
set!:
- "hello"
- "world"
- note: value chain (unqualified)
data: {}
modules:
- |
package test
a = {
"b" : 5
}
x = a.b
# The second look up must also produce the same value.
y = a.b
query: data.test.y
want_result: 5