mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
test: align VM ObjectSet collision expectations
Agent-Logs-Url: https://github.com/microsoft/regorus/sessions/34a4e1b3-d364-46c4-9998-b00780f5d339 Co-authored-by: anakrish <35780660+anakrish@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
117671d959
commit
bec159a580
@@ -6,9 +6,9 @@
|
||||
# Covers dynamic keys, collisions, non-string keys, and template validation
|
||||
|
||||
cases:
|
||||
- note: object_key_collision_overwrite
|
||||
description: Setting same key twice should overwrite the value
|
||||
example_rego: "{\"key\": 1, \"key\": 2}"
|
||||
- note: object_key_collision_conflict
|
||||
description: Setting same key twice with different values should raise a rule output conflict
|
||||
example_rego: "p[key] := value if { value := [1, 2][_] }"
|
||||
literals:
|
||||
- {}
|
||||
- "key"
|
||||
@@ -26,9 +26,9 @@ cases:
|
||||
- "Load { dest: 2, literal_idx: 2 }" # value 1
|
||||
- "ObjectSet { obj: 0, key: 1, value: 2 }"
|
||||
- "Load { dest: 3, literal_idx: 3 }" # value 2
|
||||
- "ObjectSet { obj: 0, key: 1, value: 3 }" # Overwrite
|
||||
- "ObjectSet { obj: 0, key: 1, value: 3 }" # Conflict
|
||||
- "Return { value: 0 }"
|
||||
want_result: {"key": 2}
|
||||
want_error: "multiple outputs"
|
||||
|
||||
- note: object_dynamic_key_generation
|
||||
description: Generate object keys dynamically from loop iteration
|
||||
|
||||
Reference in New Issue
Block a user