test: add edge-case tests for simpletransaction and filecontent#1493
Conversation
simpletransaction (6 → 14 tests): - transactionIsOver with wrong id returns INVALID - transactionIsOver on empty queue returns INVALID - transactionEnd without prior transactionStart is a no-op - transactionStart + transactionEnd without transactionAdd queues nothing - transactionEnd result process differs from transactionAdd trigger - deeply nested transaction: inner add overwrites outer, outer end wins filecontent (19 → 26 tests): - allFields=true includes unlabelled name:value pairs - allFields=true excludes bare URL lines (http://... parsed as colon-name) - CRLF line endings: value.trimmed() strips the trailing \r - multiple otpauth:// lines are all kept in getRemainingData but all hidden from getRemainingDataForDisplay - OTPAUTH:// (uppercase) is also hidden (case-insensitive check) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds unit tests: FileContent parsing tests for all-fields extraction, URL-line exclusion, CRLF trimming, and otpauth display/remaining-data behavior; SimpleTransaction tests for invalid/empty transaction states, start/end/add semantics, and nested-transaction selection. ChangesFileContent Parsing Test Coverage
SimpleTransaction Transaction Edge Case Coverage
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/auto/simpletransaction/tst_simpletransaction.cpp`:
- Around line 90-131: Replace the QCOMPARE assertions in the test methods
transactionIsOverWrongIdReturnsInvalid,
transactionIsOverEmptyQueueReturnsInvalid, transactionEndWithoutStartIsNoop,
transactionStartEndWithoutAddIsNoop, transactionEndResultDiffersFromAdd, and
deeplyNestedTransactionUsesLastAdd with QVERIFY2 checks that include explicit
failure messages; each message should state the intent (e.g., "Expected
transactionIsOver to return INVALID when wrong id provided" for
transactionIsOverWrongIdReturnsInvalid) and reference the expected Enums value
and the operation that produced it (use names like transactionAdd,
transactionStart, transactionEnd, transactionIsOver and the specific Enums
values such as PASS_SHOW, PASS_INSERT, GIT_ADD, GIT_COMMIT, GIT_PUSH) so
failures clearly indicate which operation and expected enum failed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: f086dd95-9522-4073-9110-f640bee5dcd4
📒 Files selected for processing (2)
tests/auto/filecontent/tst_filecontent.cpptests/auto/simpletransaction/tst_simpletransaction.cpp
Each failure message now names the operation (transactionAdd, transactionStart, transactionEnd, transactionIsOver), the specific Enums values involved (PASS_SHOW, PASS_INSERT, GIT_ADD, GIT_COMMIT, GIT_PUSH, INVALID), and the causal chain so a failure output is self-explanatory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
transactionIsOverwith wrong id, empty queue,transactionEndwithouttransactionStart, start+end without add, result process differing from trigger process, and deeply nested transactionsallFields=truemode, URL-line exclusion in allFields, CRLF named-value trimming, multipleotpauth://lines hidden from display, and case-insensitiveOTPAUTH://hidingTest plan
make checkpasses locally for both suites (14 + 26 tests, 0 failures)clang-format --style=fileapplied🤖 Generated with Claude Code
Summary by CodeRabbit