Files
regorus/tests/interpreter/cases/compr/object.yaml
Anand Krishnamoorthi 2436467fbd Minimize PR 22 (#26)
* specific functions added to eval different rego components

Signed-off-by: eric-therond <eric.therond.fr@gmail.com>

* allow multiple inputs and results

Signed-off-by: eric-therond <eric.therond.fr@gmail.com>

* prepare_for_eval is necessary to be called

Signed-off-by: eric-therond <eric.therond.fr@gmail.com>

* test with the suggested code examples and clean scopes

Signed-off-by: eric-therond <eric.therond.fr@gmail.com>

* try to refactor first steps of evaluations

Signed-off-by: eric-therond <eric.therond.fr@gmail.com>

* improve coverage and fix clean state internal evaluation

Signed-off-by: eric-therond <eric.therond.fr@gmail.com>

* add getters and setters and fix clean function

Signed-off-by: eric-therond <eric.therond.fr@gmail.com>

* Tests are single input by default. Multi input specified via "many!" marker.

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>

---------

Signed-off-by: eric-therond <eric.therond.fr@gmail.com>
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Co-authored-by: eric-therond <eric.therond.fr@gmail.com>
2023-10-09 14:27:31 -07:00

67 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`"