Files
regorus/tests/interpreter/cases/data/tests.yaml
Anand Krishnamoorthi e61b406547 OPA conformance (#71)
- Remove unnecessary memory allocations
- Add --non-strict flag
- Ensure that only empty modules (ones without rules) are initialzed prior to evaluating rules.
- Record rule as entry for each of its prefixes.
  For example, for a rule a.b.c =... in package test, record it in
  rules["data.test.a"], rules["data.test.a.b"] and rules["data.test.a.b.c"]

  This allows evaluating the correct list of rules based on expessions
  a.b.c, a.b, a, data.test.a.b.c, data.test.a.b, data.test.a

Closes #69
Closes #70

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
2023-12-23 11:55:25 -08:00

70 lines
1.2 KiB
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cases:
- note: numbers are converted to string as needed when indexing data
data:
"1": "hello"
"1.2": "world"
test:
"2": 100
"2.2": 200
play:
"2": 100
modules:
- |
package test
p = v {
q = data.play
# 2 is not converted to "2" since refr doesn't being with `data`
v = q[2]
}
a = [
data[1],
data[1.2],
data.test[2],
data.test[2.2]
]
query: data.test
want_result:
"2": 100
"2.2": 200
a:
- "hello"
- "world"
- 100
- 200
- note: overriding refs in data produces no error
data:
test:
rule1: 0
modules:
- |
package test
rule1 = 6
query: data.test.rule1
want_result: 0
- note: rule named data
data:
test:
rule1: 8
modules:
- |
package test
data.test.rule1 = 9
data.test.rule1 = 9
query: data.test
want_result:
rule1: 8
data:
test:
rule1: 9