Skip to content

Commit e47e01e

Browse files
Convert compliance tests to yaml and clean up tests (#69)
* Convert compliance tests to yaml and clean up tests * Add "comment" field to function tests * Added instructions for running tests. * Renamed grammar compliance schema file. * Clean up error output * Handle non-exact error output * Clean up more failing tests Co-authored-by: springcomp <[email protected]>
1 parent 1ce0d40 commit e47e01e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+4917
-6520
lines changed

.github/workflows/test_validate.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v2
2020
- id: set-matrix
21-
run: echo "::set-output name=matrix::$(ls grammar/*.json | jq -R -s -c 'split("\n")[:-1]')"
21+
run: echo "::set-output name=matrix::$(ls grammar/*.yml | jq -R -s -c 'split("\n")[:-1]')"
2222
validate-tests:
2323
needs: list-tests
2424
runs-on: ubuntu-latest
@@ -33,7 +33,7 @@ jobs:
3333
cache-dependency-path: .github/workflows/validate_requirements.txt
3434
- run: pip install -r .github/workflows/validate_requirements.txt
3535
- name: Validate grammar tests
36-
run: "check-jsonschema --schemafile test_schema.yml ${{ matrix.manifest }}"
36+
run: "check-jsonschema --schemafile grammar_schema.yml ${{ matrix.manifest }}"
3737

3838
list-functions:
3939
runs-on: ubuntu-latest

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# JMESPath Enhancement Proposals
1+
# JMESPath Specification
22

33
Any changes to the JMESPath specification
44
(https://jmespath.site/specification.html) must have a JEP (JMESPath Enhancement
@@ -50,3 +50,15 @@ these tenets gives your proposal a higher likelihood of being accepted:
5050
constructs that are difficult to implement in another language.
5151
* JMESPath strives to have one way to do something.
5252
* Features are driven from real world use cases.
53+
54+
# JMESPath Compliance Tests
55+
56+
This repo contains a suite of JMESPath compliance tests. JMESPath's implementations can use these tests in order to verify their
57+
implementation adheres to the JMESPath spec.
58+
59+
## Test Organization
60+
61+
`grammar/*.yml` contains tests for general grammar functionality. These documents must validate against the `grammar_schema.yml`.
62+
63+
`functions/*.yml` contains a description of each function accompanied by a suite of tests/examples. These documents must validate against the `function_schema.yml`.
64+

bin/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# JMESPath Compliance Tests
2+
3+
This repo contains a suite of JMESPath compliance tests. JMESPath's implementations can use these tests in order to verify their
4+
implementation adheres to the JMESPath spec.
5+
6+
## Test Organization
7+
8+
`grammar/*.yml` contains tests for general grammar functionality. These documents must validate against the `grammar_schema.yml`.
9+
10+
`functions/*.yml` contains a description of each function accompanied by a suite of tests/examples. These documents must validate against the `function_schema.yml`.
11+
12+
## Running Tests
13+
14+
This repository include a Python `jp-compliance` executable test runner.
15+
16+
```
17+
jp-compliance <executable> <test yaml> [<test name>..]
18+
```
19+
20+
This will run the JMESPath compliance tests against a JMESPath executable.
21+
The executable must accept the query as the only argument, and the input data on stdin.
22+
The result must be printed to stdout as JSON.
23+
Errors must be printed to stderr and match expected values.
24+
25+
If your executable requires additional arguments, wrap it in an executable script.
26+
27+
The test YAML must validate against function_schema.yml or test_schema.yml.
28+
29+
Additionally, test names can be supplied to only execute matching tests

0 commit comments

Comments
 (0)