Files
Philip Conrad 63e1877c48 linters+testdata: Reformat all yaml testcases for linting. (#6511)
This commit adds a config for yamllint, mass-reformats all of
the existing Yaml testcases to pass linting, and adds a Yaml
linting job to the pull-request Github Actions workflow. A few 
careful exceptions and ignores were added to the linter's
config to allow keeping our existing Yaml files with minimal
reformatting.

Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
2024-01-10 13:16:01 -05:00

126 lines
2.7 KiB
YAML

---
cases:
- note: objectget/empty_path_returns_object
query: data.test.p = x
modules:
- |
package test
p = x {
x := object.get({"a": 1}, [], 2)
}
want_result: [{ x: { a: 1 } }]
- note: objectget/path_with_single_element
query: data.test.p = x
modules:
- |
package test
p = x {
x := object.get({ "a": 1 }, ["a"], 2)
}
want_result: [{ x: 1 }]
- note: objectget/path_with_two_elements
query: data.test.p = x
modules:
- |
package test
p = x {
x := object.get({ "a": { "b": 1 } }, ["a", "b"], 2)
}
want_result: [{ x: 1 }]
- note: objectget/path_with_three_elements
query: data.test.p = x
modules:
- |
package test
p = x {
x := object.get({ "a": { "b": { "c": 1 } } }, ["a", "b", "c"], 2)
}
want_result: [{ x: 1 }]
- note: objectget/path_with_single_element_no_result
query: data.test.p = x
modules:
- |
package test
p = x {
x := object.get({ "a": 1 }, ["b"], 2)
}
want_result: [{ x: 2 }]
- note: objectget/path_with_two_elements_no_result
query: data.test.p = x
modules:
- |
package test
p = x {
x := object.get({ "a": { "b": 1 } }, ["b", "a"], 2)
}
want_result: [{ x: 2 }]
- note: objectget/path_with_three_elements_no_result
query: data.test.p = x
modules:
- |
package test
p = x {
x := object.get({ "a": { "b": { "c": 1 } } }, ["a", "b", "a"], 2)
}
want_result: [{ x: 2 }]
- note: objectget/path_with_non_string_keys
query: data.test.p = x
modules:
- |
package test
p = x {
x := object.get({ 1: { "b": { [1,2,3]: 1 } } }, [1, "b", [1,2,3]], 2)
}
want_result: [{ x: 1 }]
- note: objectget/get_intermediate_non_object
query: data.test.p = x
modules:
- |
package test
p = x {
x := object.get({ "a": { "b": [1,2,3] } }, ["a", "b", "a"], 2)
}
want_result: [{ x: 2 }]
- note: objectget/get_intermediate_array
query: data.test.p = x
modules:
- |
package test
p = x {
x := object.get({ "a": { "b": [{"c": 1}] } }, ["a", "b", 0, "c"], 2)
}
want_result: [{ x: 1 }]
- note: objectget/get_for_non_object
query: data.test.p = x
input_term: '{"obj":"object"}'
modules:
- |
package test
p = x {
x := object.get(input.obj, ["a"], 2)
}
want_error: "object.get: operand 1 must be object but got string"
want_error_code: eval_type_error
strict_error: true