mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
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>
This commit is contained in:
committed by
GitHub
parent
ad3282caf4
commit
e61b406547
@@ -37,7 +37,7 @@ cases:
|
||||
- 100
|
||||
- 200
|
||||
|
||||
- note: overriding refs in data produces error
|
||||
- note: overriding refs in data produces no error
|
||||
data:
|
||||
test:
|
||||
rule1: 0
|
||||
@@ -46,8 +46,8 @@ cases:
|
||||
package test
|
||||
|
||||
rule1 = 6
|
||||
query: data.test
|
||||
error: value for rule has already been specified
|
||||
query: data.test.rule1
|
||||
want_result: 0
|
||||
|
||||
- note: rule named data
|
||||
data:
|
||||
|
||||
@@ -50,6 +50,9 @@ intersection
|
||||
invalidkeyerror
|
||||
jsonfilter
|
||||
jsonfilteridempotent
|
||||
jsonremove
|
||||
jsonremoveidempotent
|
||||
jsonschema
|
||||
jwtencodesignheadererrors
|
||||
jwtencodesignpayloaderrors
|
||||
negation
|
||||
@@ -96,5 +99,6 @@ typenamebuiltin
|
||||
undos
|
||||
union
|
||||
units
|
||||
uuid
|
||||
varreferences
|
||||
virtualdocs
|
||||
+2
-1
@@ -169,7 +169,8 @@ fn run_opa_tests(opa_tests_dir: String, folders: &[String]) -> Result<()> {
|
||||
{
|
||||
entry.0 += 1;
|
||||
}
|
||||
(Err(_), None) if case.want_error.is_some() => {
|
||||
// TODO: Handle tests that specify both want_result and strict_error
|
||||
(Err(_), _) if case.want_error.is_some() => {
|
||||
// Expected failure.
|
||||
entry.0 += 1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ fn match_span(s: &Span, v: &Value) -> Result<()> {
|
||||
match &v {
|
||||
Value::String(vs) => {
|
||||
my_assert_eq!(
|
||||
*s.text(),
|
||||
s.text(),
|
||||
vs.as_ref(),
|
||||
"{}",
|
||||
s.source
|
||||
|
||||
Reference in New Issue
Block a user