Files
regorus/tests/interpreter/cases/rule/prefix.yaml
Anand Krishnamoorthi 595f9d34d5 Separately keep track of whether rules have been evaluated or not (#163)
Previously we used to rely on whether there was a value in the
data document for a given rule path. This approach cannot handle
the case of evaluating a.b when a.b.c has been evaluated but
a.b.d has not been evaluated. Upon evaluating a.b.c, the data document
will already have a value of a.b even though a.b.d has not yet
been evaluated.

Hence we need to keep track of evaluated rules separately.

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
2024-02-25 23:36:48 -08:00

65 lines
981 B
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cases:
- note: prefix after rules
data: {}
modules:
- |
package test
a.b.c = 1
a.b.d = 2
y = a.b
query: data.test
want_result:
a:
b:
c: 1
d: 2
y:
c: 1
d: 2
- note: prefix between rules
data: {}
modules:
- |
package test
a.b.c = 1
y = a.b
a.b.d = 2
query: data.test
want_result:
a:
b:
c: 1
d: 2
y:
c: 1
d: 2
- note: prefix between rules
data: {}
modules:
- |
package test
a.b.c = 1
y = a.b
a.b.d = 2
a[p][q] = 3 {
p = "b"
q = "e"
}
query: data.test
want_result:
a:
b:
c: 1
d: 2
e: 3
y:
c: 1
d: 2
e: 3
skip: true