Files
regorus/tests/rvm/rego/cases/comparisons.yaml
Anand Krishnamoorthi bedf667adc feat: Handle literal comparisons that use = and comprehensions without loops
- emit AssertCondition for equality-only assignment plans (outside soft-assert mode) so rules like `0 = 1` fail under the VM just like the interpreter
- let comprehension bodies consume assertion failures by advancing or exiting their iteration context, both in run-to-completion and suspendable execution

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
2025-12-03 13:34:14 -06:00

63 lines
1.1 KiB
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Comparison Operations Test Suite
# Tests comparison operators: ==, <, >, <=, >=, !=
cases:
- note: comparison_equals
data: {}
modules:
- |
package test
main := result if {
result := (5 == 5)
}
query: data.test.main
want_result: true
- note: comparison_not_equals
data: {}
modules:
- |
package test
main := result if {
result := (5 == 3)
}
query: data.test.main
want_result: false
- note: comparison_less_than
data: {}
modules:
- |
package test
main := result if {
result := (3 < 5)
}
query: data.test.main
want_result: true
- note: comparison_greater_than
data: {}
modules:
- |
package test
main := result if {
result := (7 > 5)
}
query: data.test.main
want_result: true
- note: equality_literal_failure
data: {}
modules:
- |
package test
x if {
0 = 1
}
query: data.test.x
want_result: "#undefined"