mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Set loop index variable if not "_" (#3)
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
23
tests/interpreter/cases/loop/basic.yaml
Normal file
23
tests/interpreter/cases/loop/basic.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
# 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"]]
|
||||
Reference in New Issue
Block a user