Code from github.com/anakrish/rego-rs

Authored by anakrish and mingweishih

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2023-02-09 10:56:54 -08:00
parent 8f67aeecb0
commit cb0b3a1790
85 changed files with 11144 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
# Copyright (c) Rego-Rs Authors.
# Licensed under the Apache 2.0 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: