mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Implement every statement (#4)
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
# Copyright (c) Microsoft Corporation. Licensed under the MIT
|
||||
# License.
|
||||
|
||||
cases:
|
||||
- note: basic
|
||||
@@ -28,7 +28,7 @@ cases:
|
||||
stmts:
|
||||
- literal:
|
||||
every:
|
||||
key: x
|
||||
value: x
|
||||
domain:
|
||||
array:
|
||||
- number: 2
|
||||
|
||||
@@ -525,19 +525,19 @@ fn match_literal(l: &Literal, v: &Value) -> Result<()> {
|
||||
query,
|
||||
} => {
|
||||
match_span_opt(span, &v["every"]["span"])?;
|
||||
match_span(key, &v["every"]["key"])?;
|
||||
match value {
|
||||
Some(s) => match_span(s, &v["every"]["value"])?,
|
||||
match_span(value, &v["every"]["value"])?;
|
||||
match key {
|
||||
Some(s) => match_span(s, &v["every"]["key"])?,
|
||||
None => {
|
||||
my_assert_eq!(
|
||||
&Value::Undefined,
|
||||
&v["value"],
|
||||
&v["key"],
|
||||
"{}",
|
||||
span.source.message(
|
||||
span.line,
|
||||
span.col,
|
||||
"mismatch-error",
|
||||
"could not match `value``"
|
||||
"could not match `key``"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user