diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-26 18:37:47 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-26 18:37:47 -0500 |
| commit | 439effb54aa8631751a758cb65140800af7e6e63 (patch) | |
| tree | 10a61a77df500a62def67b9ac1f494d370c0af16 /scripts/coverage-summary.py | |
| parent | 537b58c431946ba34146743fc8be4fd671aac6d4 (diff) | |
| download | emacs-wttrin-439effb54aa8631751a758cb65140800af7e6e63.tar.gz emacs-wttrin-439effb54aa8631751a758cb65140800af7e6e63.zip | |
test: cover wttrin-geolocation internal helpers
Four pure helpers in wttrin-geolocation.el were exercised only indirectly through the parser tests: --decode-json, --format-city-region, --lookup-provider, and --extract-body. None of them had direct unit coverage. Edge cases like an empty JSON object, a missing-vs-empty city field, an unknown provider symbol, or a missing HTTP body separator weren't locked.
The new file groups all four functions together. Each gets Normal, Boundary, and Error cases per testing.md. Highlights:
- --decode-json: distinguishes nil input, empty string, and malformed JSON, all of which return nil for different reasons.
- --format-city-region: separates "missing key" from "empty string" since the predicate `(and (stringp city) (> (length city) 0) ...)` short-circuits on either.
- --lookup-provider: tests two of the three built-ins plus a `let`-bound synthetic provider, locking the documented extension point on `wttrin-geolocation--providers`.
- --extract-body: real UTF-8 bytes inserted into a temp buffer (mirroring what `url-retrieve` delivers) verify the decoding path. 4xx, 5xx, and missing-separator paths each get their own test.
21 new tests, all green on first run since they characterize existing behavior.
Diffstat (limited to 'scripts/coverage-summary.py')
0 files changed, 0 insertions, 0 deletions
