mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
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>
58 lines
848 B
YAML
58 lines
848 B
YAML
cases:
|
|
- note: forward-ref
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
a = b
|
|
b = 5
|
|
query: data.test
|
|
want_result:
|
|
a: 5
|
|
b: 5
|
|
|
|
- note: recursive
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
a = b
|
|
b = c
|
|
c = a
|
|
query: data.test
|
|
error: recursion detected
|
|
|
|
- note: cross-module
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package a
|
|
x = data.b.y * 2
|
|
- |
|
|
package b
|
|
y = 10
|
|
z = data.a.x + 5
|
|
query: data
|
|
want_result:
|
|
a:
|
|
x: 20
|
|
b:
|
|
y: 10
|
|
z: 25
|
|
|
|
- note: inter
|
|
data: {}
|
|
modules:
|
|
- |
|
|
package test
|
|
a.b.c = 1
|
|
a.b.d = a.b.e
|
|
a.b.e = a.b.c
|
|
query: data.test
|
|
want_result:
|
|
a:
|
|
b:
|
|
c: 1
|
|
d: 1
|
|
e: 1
|