Files
regorus/tests/interpreter/cases/loop/basic.yaml
Anand Krishnamoorthi 2a1924efa5 Set loop index variable if not "_" (#3)
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
2023-02-28 09:38:40 +05:30

24 lines
542 B
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cases:
- note: basic
data: {}
modules:
- |
package test
x1 = y {
y = [ [a, b] | a = [1, 2, 3, 4][b] ]
}
x2 = y {
y = [ [a, b] | a = {1, 2, 3, 4}[b] ]
}
x3 = y {
y = [ [a, b] | a = {"p":"q", "r": "s"}[b] ]
}
query: data.test
want_result:
x1: [[1, 0], [2, 1], [3, 2], [4, 3]]
x2: [[1, 1], [2, 2], [3, 3], [4, 4]]
x3: [["q", "p"], ["s", "r"]]