Tests: ngx_http_json_module tests. - #101
Conversation
347aa85 to
02a6707
Compare
6284bcb to
f6ba9ea
Compare
|
The PR description no longer matches the diff: it says there is a separate Could the description be updated to match the current coverage? |
e533a26 to
5077b2b
Compare
pluknet
left a comment
There was a problem hiding this comment.
please rename json_parset.t to json_set.t - to follow the naming convention of using the (main) directive name as exported by the tested module
I didn't look deeply into the essence of the tests, especially into the syntax-related.
If you believe they are truly needed and they pass on all tested platforms, I'm ok to keep them.
|
It's time to take care of these tests a bit! Roman -> Ivan |
Co-authored-by: Ivan Ovchinnikov <i.ovchinnikov@f5.com>
5077b2b to
a65785e
Compare
There was a problem hiding this comment.
All of pluknet's comments are addressed.
Plus the coverage gaps and two defects in the config-check helper:
- tests added to cover whitespace characters (
ngx_json_ws()branch) - certain num vals and exponent sign processing
- top-level scalars
- expanded malformed docs tests
- escape decoding
- empty string val
- some config time tests
Plus some issues with config checks:
run_check_conf()writes the config using standardopen/printcalls, bypassingwrite_file_expand()=>listen 127.0.0.1:8080directive within it is not replaced with the allocated port =>prove -j= failserver {}block is unnecessary and removed
Now we have 102 tests. Coverage:
| file | strings | branches |
|---|---|---|
| ngx_http_json_module.c | 92.33% (391) | 82.05% (234) |
| ngx_json_parse.c | 89.46% (408) | 79.72% (355) |
| ngx_json_unescape.c | 96.77% (124) | 85.94% (64) |
Delta relative to the previous coverage: +1.8 / +11.8 / +15.3 by line, +1.7 / +17.8 / +17.2 by branch.
I made a few adjustments to the sandbox CI so that the json module builds by default and there are no checks in has(). All tests are passing successfully.
Proposed changes
Added json_parser.t covering json_set value extraction (scalars, nested
objects and arrays, compound containers, literals, number types, escapes,
the '$' root selector, source caching, last-match-wins on duplicate keys,
quoted key segments, and binary-safe / Unicode / surrogate-pair keys), and
json_parser_invalid.t covering rejection of malformed json_set paths at
configuration load.
Checklist
Before creating a PR, run through this checklist and mark each as complete:
README.mdand/orCHANGELOG.md).