Compliance tests for the RESO RCP-19's validation expressions.
This repository contains tests to help encourage compliance and interoperability for parsers and interpreters that target RCP-19 validation expressions.
Every test takes a known set of inputs and a validation expression and indicates the expected output.
The tests are provided in JSON for maximium interoperability. It is assumed that most languages being used to build validation expression interpreters have an easy way to parse JSON.
This repository is most valuable to people implementing a parser and interpreter for RCP-19 validation expressions. In conjunction with the RCP-19 spec, these tests can help validate that a parser and interpreter are interoperable with the spec and other implementations.
These tests are not runnable on their own. They are intended to be used as inputs into a particular implementation of a validation expression interpreter.
Individual implementations may have ways to pull in these tests and run the test suite.
YES! Open a pull request. This is intended to be a community-owned resource that helps encourage interoperability between implementations.
- rets_expression – Zenlist's parser written in Rust, used to power rules.zenlist.dev.
If you are using these tests for your own interpeter – whether that interpeter is open source and has a link or closed source and does not have a link – please feel free to open a PR to add to this list.
The tests in the tests
folder are broken down into files that are named according to their purpose.
Each file contains:
- a file name, and
- one or more test sets.
Each test set contains:
- name (required, string) – the name of the particular test set.
- context (required, JSON object) – describes the inputs to the interpreter, which typically includes things like the data payload being validated and the previous data payload for use with
LAST FieldName
expressions. - checks (required, JSON array) – an array of checks that describe both the expression to be run (within the provided context) and the expected output.
Each context contains:
- value (required, JSON object) – the data payload that is being evaluated. This is used for
FieldName
/[FieldName]
expressions. - previousValue (optional, JSON object) – the previous data payload that is being evaluated. This is used for
LAST FieldName
/[LAST FieldName]
expressions. - now (optional, RFC3339 timestamp) – the exact timestamp to use for
.NOW.
expressions. This is sometimes required to test date/time assumptions. - timezone (optional, IANA tzdb identifier) – used with the now context, describes the timezone that the evaluator is operating in.
Each check contains:
- expr (required, string) – the RCP-19 Validation Expression being evaluated.
- One of (required):
- expected (JSON) – the expected output of the expression.
- error (the exact value
true
) – the expression is expected to return an error (either because of a parse error or an evaluation error)