Skip to content

Add comprehensive unit tests for src/main.rs to reach >80% coverage#57

Closed
Copilot wants to merge 3 commits into
masterfrom
copilot/add-tests-for-coverage
Closed

Add comprehensive unit tests for src/main.rs to reach >80% coverage#57
Copilot wants to merge 3 commits into
masterfrom
copilot/add-tests-for-coverage

Conversation

Copilot AI commented Apr 22, 2026

Copy link
Copy Markdown

src/main.rs had only 1 unit test, leaving large portions of the binary's logic uncovered per SonarCloud's new code coverage report.

Description

Added 38 new unit tests directly in src/main.rs covering all previously untested functions and branches.

New test coverage

  • Cli struct methodsget_project_path (default/custom), is_verbose, get_output, is_pretty, is_minify (via both --minify and --m2), is_aggressive_minify, get_transform_config (all flag combinations: keep_tests, keep_docs, no_expand_modules, minify, m2)
  • minify_code() — empty input, single-line passthrough, multi-line joining, whitespace trimming, empty-line filtering
  • aggressive_minify_code() — escaped string literals, char literals, empty input, trailing comma cleanup before }, ), ]
  • should_rebuild()Create/Modify/Remove events on .rs files (→ true); non-RS extensions, Access, Other, Any events, empty path list (→ false)
  • display_bug_report_info() — smoke test for no panic
  • format_with_rustfmt() — valid code and syntactically invalid code (returns None gracefully)

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • Performance improvement
  • Other (please describe): Test coverage improvement

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • I have updated the CHANGELOG.md

Screenshots (if applicable)

Additional context

All 39 tests (1 existing + 38 new) pass. Clippy reports no linting issues.

Copilot AI linked an issue Apr 22, 2026 that may be closed by this pull request
@MathieuSoysal

Copy link
Copy Markdown
Owner

@copilot It should be clippy compiliant and have good format

…mma tests

Agent-Logs-Url: https://github.com/MathieuSoysal/CG-Bundler/sessions/4413ff49-4c71-442a-b35e-c4df582e770c

Co-authored-by: MathieuSoysal <43273304+MathieuSoysal@users.noreply.github.com>
Copilot AI changed the title [WIP] Add tests to increase code coverage above 80% Add comprehensive unit tests for src/main.rs to reach >80% coverage Apr 22, 2026
Copilot AI requested a review from MathieuSoysal April 22, 2026 10:34
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.

Reaching coverage

2 participants