Commit 256eb5c
authored
Add conformance testing to string.format implementation (#293)
Apologies for the large PR. The logical way to split this up is for
`Format.java` to be its own PR with everything else separate but it may
just be easier to review this all at once. So, an easy way to review is:
* `Format.java` for all the formatting fixes
* Everything else that runs the conformance tests
This adds conformance testing to our implementation of `string.format`.
cel-java does not currently provide a `string.format` function so we
implement our own and add it to the protovalidate-java CEL runtime.
While formatting is not (yet) a part of the cel-spec, they do provide
conformance test data for validating behavior. So, to ensure we are
conformant, we use this test data and run it against our implementation.
See the test data
[here](https://github.com/google/cel-spec/blob/master/tests/simple/testdata/string_ext.textproto).
Note that this file contains various sections for testing. However, we
are only concerned with the `format` and `format_errors` sections. In
addition, since we are only testing for formatting, we do not handle
every `oneof` case or variation in the `SimpleTest` definition -- only
expected results or evaluation errors. If others are added down the road
in future versions of the spec, we can adjust these tests.
There are few tests marked as skipped in `FormatTest` as these seem to
be related to issues in cel-java's runtime (or in how we set up our
environment) because the same issues happen when trying to use those
expressions in protovalidate-java. Probably worth investigating or
filing an issue for cel-java, but didn't want to hold up this PR.1 parent 864c3f7 commit 256eb5c
File tree
7 files changed
+1868
-162
lines changed- src
- main/java/build/buf/protovalidate
- test
- java/build/buf/protovalidate
- resources
- proto
- testdata
7 files changed
+1868
-162
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
93 | 151 | | |
94 | | - | |
| 152 | + | |
95 | 153 | | |
96 | 154 | | |
97 | 155 | | |
| |||
206 | 264 | | |
207 | 265 | | |
208 | 266 | | |
| 267 | + | |
209 | 268 | | |
210 | 269 | | |
211 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments