Skip to content

test: expand passwordconfig and filecontent test suites#1498

Merged
annejan merged 2 commits into
mainfrom
test/passwordconfig-filecontent-tests
May 16, 2026
Merged

test: expand passwordconfig and filecontent test suites#1498
annejan merged 2 commits into
mainfrom
test/passwordconfig-filecontent-tests

Conversation

@nogeenharrie
Copy link
Copy Markdown
Contributor

@nogeenharrie nogeenharrie commented May 16, 2026

Summary

passwordconfig: 9 → 22 tests — character-set invariant checks:

  • ALLCHARS contains letters, digits, and special characters
  • ALPHANUMERIC contains digits and both letter cases
  • ALPHABETICAL contains both upper and lower case
  • ALLCHARS ⊇ ALPHANUMERIC ⊇ ALPHABETICAL (superset hierarchy)
  • No duplicate characters in any preset charset
  • ALLCHARS is strictly larger than ALPHANUMERIC

filecontent: 24 → 34 tests — NamedValues and edge cases:

  • NamedValues default constructor creates an empty list
  • NamedValue equality operator (positive, name mismatch, value mismatch)
  • takeValue removes only the first match when duplicate keys exist
  • Unicode password line and unicode field values round-trip correctly
  • Field with spaces around colon parsed correctly in allFields mode
  • getRemainingData is empty when all fields match the template

Test plan

  • tst_passwordconfig: 22 passed, 0 failed
  • tst_filecontent: 34 passed, 0 failed (was 24)
  • clang-format applied

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added comprehensive tests for named values: default emptiness, equality/inequality cases, removing only the first matching value, and ensuring no leftover data when templates fully match.
    • Added password character-set validations: presence of special/uppercase/lowercase/digit characters, subset/superset relationships between sets, size comparisons, and duplicate-free checks.
    • Added Unicode and parsing tests for passwords and field values, including handling of spaces around delimiters.

Review Change Stack

passwordconfig: 9 → 22 tests — adds character-set invariant checks:
ALLCHARS contains letters/digits/specials; ALPHANUMERIC contains digits
and letters; ALPHABETICAL contains upper and lower; ALLCHARS ⊇
ALPHANUMERIC ⊇ ALPHABETICAL; no duplicate characters in any preset.

filecontent: 24 → 34 tests — adds NamedValues default constructor,
NamedValue equality/inequality by name and value, takeValue removes only
the first match, unicode password and field values, field with spaces
around colon (allFields mode), and getRemainingData empty when all fields
match the template.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: dffb3278-1804-45b3-a15f-0c3fc09e9489

📥 Commits

Reviewing files that changed from the base of the PR and between 2b61bf1 and b145b71.

📒 Files selected for processing (1)
  • tests/auto/passwordconfig/tst_passwordconfig.cpp

📝 Walkthrough

Walkthrough

Adds new Qt tests: filecontent tests for NamedValues parsing/comparison, Unicode and parsing edge cases, and getRemainingData; passwordconfig tests for charset composition, subset/superset relationships, duplicate-free constraints, and size invariants.

Changes

FileContent and NamedValues Unit Tests

Layer / File(s) Summary
NamedValues semantics and FileContent parsing edge cases
tests/auto/filecontent/tst_filecontent.cpp
Declares and implements test slots covering NamedValues default construction emptiness, equality/inequality operators, takeValue removing only the first match, Unicode preservation for passwords and field values, allFields parsing with spaces around colons, and getRemainingData behavior when all template fields match.

PasswordConfiguration Character Set Validation

Layer / File(s) Summary
Includes and slot declarations
tests/auto/passwordconfig/tst_passwordconfig.cpp
Adds #include <QSet> and new Q_SLOT declarations used by the charset invariant tests.
Character set composition tests
tests/auto/passwordconfig/tst_passwordconfig.cpp
Implements tests asserting ALLCHARS includes at least one special character, uppercase letter, lowercase letter, and digit; ALPHABETICAL contains uppercase and lowercase; ALPHANUMERIC contains at least one digit.
Character set relationships and uniqueness validation
tests/auto/passwordconfig/tst_passwordconfig.cpp
Implements tests verifying ALLCHARS is a superset of ALPHANUMERIC, ALPHANUMERIC is a superset of ALPHABETICAL, each charset contains no duplicate characters, and ALLCHARS has a strictly larger character count than ALPHANUMERIC.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • IJHack/QtPass#983: Modifies tst_filecontent.cpp with assertions on NamedValues/takeValue behavior and template field matching.
  • IJHack/QtPass#981: Adds tst_filecontent slots exercising FileContent::parse and NamedValue parsing edge cases.
  • IJHack/QtPass#1495: Extends tst_passwordconfig.cpp with PasswordConfiguration charset-invariant test slots.

Suggested labels

size:M

Poem

🐰 I nibble tests with tiny paws,

Checking Unicode without a pause,
NamedValues hop, takeValue plays,
Charsets sorted in neat arrays,
Coverage blooms in twinkling claws. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: expanding test suites for passwordconfig and filecontent with additional test cases.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/passwordconfig-filecontent-tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/passwordconfig/tst_passwordconfig.cpp`:
- Around line 222-223: The test uses QSet<QChar> (the variable named "seen" and
the loop "for (QChar c : chars)") without including its header; add an explicit
`#include` <QSet> near the other Qt includes at the top of the test file that
contains these symbols to avoid relying on transitive includes.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2a10b212-d4ee-440e-8bbc-d36ad8097293

📥 Commits

Reviewing files that changed from the base of the PR and between 29cf0d5 and 2b61bf1.

📒 Files selected for processing (2)
  • tests/auto/filecontent/tst_filecontent.cpp
  • tests/auto/passwordconfig/tst_passwordconfig.cpp

Comment thread tests/auto/passwordconfig/tst_passwordconfig.cpp
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • tests/auto/passwordconfig/tst_passwordconfig.cpp

Commit: b145b71fb5de9928a8d5fdfe12ef26a3ac69d57f

The changes have been pushed to the test/passwordconfig-filecontent-tests branch.

Time taken: 1m 22s

@coveralls
Copy link
Copy Markdown

coveralls commented May 16, 2026

Coverage Status

coverage: 55.017%. remained the same — test/passwordconfig-filecontent-tests into main

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@annejan annejan merged commit 8e94e0e into main May 16, 2026
24 of 25 checks passed
@annejan annejan deleted the test/passwordconfig-filecontent-tests branch May 16, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants