test: boost unit test coverage from 68% toward 75%#702
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #702 +/- ##
==========================================
+ Coverage 68.38% 69.43% +1.05%
==========================================
Files 46 46
Lines 31265 31838 +573
==========================================
+ Hits 21379 22104 +725
+ Misses 9886 9734 -152 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
REV Code Review
BLOCKING ISSUES (3)HIGH
HIGH
HIGH
NON-BLOCKING (5)MEDIUM
MEDIUM
MEDIUM
LOW
LOW
POTENTIAL ISSUES (2)MEDIUM
LOW
Summary
Note:
Test quality assessmentThe new unit tests add ~730 lines of coverage across five modules. Here is a frank assessment of quality: What's good:
What's coverage theater:
Missing edge cases for new code paths:
Verdict: CHANGES REQUESTED. The three blocking issues must be addressed before merge:
The SSL regression ( REV-assisted review (AI analysis by postgres-ai/rev) |
REV Review — PR #702: test: boost unit test coverageReviewed against current main (c1b21d2, v0.8.3). Previous automated review posted incorrect findings based on a stale diff — disregard it entirely. What this PR doesPure test additions across 6 files. 108 new test functions, zero production code changes:
PRAISE — Thorough coverage of URL extraction edge cases
PRAISE — Hex codec tests are exhaustiveEvery boundary (zero byte, FF byte, all-numeric, all-alpha, uppercase, lowercase, zero-padding) covered. Clean parametric style. MINOR —
|
Add pure-function unit tests across six previously untested files: - src/explain/share.rs: 14 tests for extract_depesz_url() and share_explain_plan() error paths (unknown service, empty service) - src/large_object.rs: 21 tests for hex_encode(), hex_digit(), decode_bytea_hex(), and a full roundtrip test - src/statusline.rs: 20 tests for format_status() covering all tx states, exec/input modes, duration formatting, AI token display, auto-explain, padding, and truncation - src/main.rs: 26 tests for apply_cli_pset() (all format values, border clamping, null/fieldsep/tuples_only/footer options) and version_string() - src/repl/execute.rs: 20 tests for is_explain_statement() and strip_psql_table_format() (header/footer removal, indentation preservation, blank lines, pipe-delimited content) - src/lua_commands.rs: suppress pre-existing unused_self lint on the no-lua stub function All tests are pure unit tests: no PG connections, no network calls, no sleeps. cargo test passes (1802 total), cargo fmt clean, cargo clippy -D warnings clean. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
886b776 to
7e2054b
Compare
Summary
Adds 101 new pure unit tests across six files that previously had 0% (or near-0%) coverage, targeting pure functions that need no database connection or network calls.
Files with new tests
src/explain/share.rsextract_depesz_url(),share_explain_plan()error pathssrc/large_object.rshex_encode(),hex_digit(),decode_bytea_hex(), roundtripsrc/statusline.rsformat_status()— all tx states, exec/input modes, AI tokens, truncation/paddingsrc/main.rsapply_cli_pset()(all options),version_string()src/repl/execute.rsis_explain_statement(),strip_psql_table_format()src/lua_commands.rsunused_selfclippy lint on no-lua stubBefore/after line coverage for targeted files
src/explain/share.rs: 0% → ~43% regions coveredsrc/large_object.rs: 0% → ~38% lines coveredsrc/statusline.rs: 0% → ~70% regions coveredsrc/main.rs: 0% → ~35% lines coveredsrc/repl/execute.rs: 19% → improved with 20 additional testsQuality checks
cargo test: 1802 tests pass (up from ~1700)cargo fmt: cleancargo clippy -- -D warnings: cleanTest plan
cargo test— all 1802 tests passcargo fmt— no formatting changes neededcargo clippy -- -D warnings— no warnings🤖 Generated with Claude Code