Skip to content

Add unit tests for internal/difflib package#52

Merged
fredbi merged 5 commits intomasterfrom
copilot/add-unit-tests-to-difflib
Jan 29, 2026
Merged

Add unit tests for internal/difflib package#52
fredbi merged 5 commits intomasterfrom
copilot/add-unit-tests-to-difflib

Conversation

Copy link

Copilot AI commented Jan 29, 2026

Improves test coverage in internal/difflib from 85.0% to 92.5%.

New tests in difflib_test.go

  • Caching: TestSequenceMatcherCaching, TestSetSeqSamePointer
  • Junk filtering: TestSequenceMatcherWithIsJunk, TestJunkFilteringInChainB, TestFindLongestMatchWithJunk, TestMatchExtensionWithJunkOnBothSides, TestFindLongestMatchWithJunkExtension
  • AutoJunk (n≥200): TestAutoJunkWithLargeSequence, TestAutoJunkPopularElements
  • Edge cases: TestFindLongestMatchBreakCondition, TestFindLongestMatchEdgeCases, TestFindLongestMatchExtension, TestMatcherWithBothSequencesSame, TestWriteUnifiedDiffWithDefaultEol

New tests in options_test.go

  • TestDefaultPrinterBuilder — covers previously untested export
  • TestOptionsWithAllCustomPrinters — OtherPrinter/Formatter customization
  • TestOptionsWithDefaults — nil and partial options handling

Functions now at 100% coverage

optionsWithDefaults, DefaultPrinterBuilder, defaultPrinterBuilder, defaultFormatterBuilder, GetMatchingBlocks, GetOpCodes, GetGroupedOpCodes, chainB, isBJunk

Remaining uncovered lines are error paths requiring mock io.Writer failures.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 29, 2026 09:24
Co-authored-by: fredbi <14262513+fredbi@users.noreply.github.com>
Co-authored-by: fredbi <14262513+fredbi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add additional unit tests to improve test coverage Add unit tests for internal/difflib package Jan 29, 2026
Copilot AI requested a review from fredbi January 29, 2026 09:32
@fredbi fredbi marked this pull request as ready for review January 29, 2026 09:46
Co-authored-by: fredbi <14262513+fredbi@users.noreply.github.com>
Copilot AI requested a review from fredbi January 29, 2026 09:53
addressed linting issu

Signed-off-by: fredbi <fredbi@yahoo.com>
@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.00%. Comparing base (b33472c) to head (a82b98f).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #52      +/-   ##
==========================================
+ Coverage   96.63%   97.00%   +0.37%     
==========================================
  Files          53       53              
  Lines        8227     8227              
==========================================
+ Hits         7950     7981      +31     
+ Misses        184      162      -22     
+ Partials       93       84       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fredbi fredbi merged commit 6ed8e73 into master Jan 29, 2026
21 checks passed
@fredbi fredbi deleted the copilot/add-unit-tests-to-difflib branch January 29, 2026 11:16
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.

2 participants