zen-expression 2.0.1

Zen Expression Language
Documentation
# Edge cases, slices, intervals, and miscellaneous

[[test]]
name = "empty-ish: just a number"
expression = "0"

[test.loose]
return_type = '"Number"'

[test.strict]
return_type = '"Number"'

[[test]]
name = "parenthesized expression"
expression = "(a + b) * c"
input = '{"a": 1, "b": 2, "c": 3}'
reads = [
    { type = "direct", path = ["a"] },
    { type = "direct", path = ["b"] },
    { type = "direct", path = ["c"] },
]

[test.loose]
return_type = '"Number"'

[test.strict]
return_type = '"Number"'

[[test]]
name = "unary minus"
expression = "-x"
input = '{"x": 5}'
reads = [
    { type = "direct", path = ["x"] },
]

[test.loose]
return_type = '"Number"'

[test.strict]
return_type = '"Number"'

[[test]]
name = "unary not"
expression = "not active"
input = '{"active": true}'
reads = [
    { type = "direct", path = ["active"] },
]

[test.loose]
return_type = '"Bool"'

[test.strict]
return_type = '"Bool"'

[[test]]
name = "interval"
expression = "x in [1..10]"
input = '{"x": 5}'
reads = [
    { type = "direct", path = ["x"] },
]

[test.loose]
return_type = '"Bool"'

[test.strict]
return_type = '"Bool"'

[[test]]
name = "slice operation"
expression = "items[1:3]"
input = '{"items": [1, 2, 3, 4, 5]}'
reads = [
    { type = "direct", path = ["items"] },
]

[test.loose]

[test.strict]