Files
regorus/tests/interpreter/cases/compr/object.yaml
Ming-Wei Shih c0972ad2ba Update license to MIT
Signed-off-by: Ming-Wei Shih <mishih@microsoft.com>
2023-02-09 19:40:35 +00:00

68 lines
1.3 KiB
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cases:
- note: simple
data: {}
modules:
- |
package test
x = { k:1 | k = ["Hello", "world", 1][_] }
query: data.test
want_result:
x:
object!:
- key: "Hello"
value: 1
- key: "world"
value: 1
- key: 1
value: 1
- note: key-loop
data: {}
modules:
- |
package test
x = { ["Hello", "world", 1][_]:1 | true }
query: data.test
want_result:
x:
object!:
- key: "Hello"
value: 1
- key: "world"
value: 1
- key: 1
value: 1
- note: multiple-occurance-of-same-key-value-pair
data: {}
modules:
- |
package test
x = { k:v | k = ["Hello", "world", 1][_]; v = [1, 1][_] }
query: data.test
want_result:
x:
object!:
- key: "Hello"
value: 1
- key: "world"
value: 1
- key: 1
value: 1
- note: different-values-for-same-key
data: {}
modules:
- |
package test
x = { k:v | k = ["Hello", "world", 1][_]; v = [1, 2][_] }
query: data.test
error: "value for key `\"Hello\"` generated multiple times: `1` and `2`"
want_result: