Skip to content

Add codegen and logging test coverage with Codecov config - #260

Merged
ptr727 merged 2 commits into
developfrom
test/coverage-and-codecov
Jul 11, 2026
Merged

Add codegen and logging test coverage with Codecov config#260
ptr727 merged 2 commits into
developfrom
test/coverage-and-codecov

Conversation

@ptr727

@ptr727 ptr727 commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

Test and configuration changes only, no functional/library behavior changes.

  • Codecov config (codecov.yml): scoped to the LanguageTags library, generated code ignored so coverage reflects hand-written code. Kept informational (report-only) until a default-branch upload establishes a baseline under these ignores; then it can be flipped to block on regressions.
  • Codegen emitter coverage: SaveCodeAsync_GeneratesCode tests emit the code and parse it with Roslyn (CSharpSyntaxTree.ParseText), asserting zero error-severity diagnostics, so an escaping/literal regression fails at test time. LanguageSchema.GetCodeGenString is unit-tested including quote escaping.
  • Logging coverage: LogExtensions.LogAndPropagate / LogAndHandle.
  • EditorConfig cleanup: dropped redundant LanguageTagsTests/.editorconfig overrides (IDE0058, IDE0052, CS1591); the discard operator already satisfies IDE0058. CA1707 and CA1515 stay with rationale comments.
  • Dependency: Microsoft.CodeAnalysis.CSharp as a test-only package (IsPackable=false, never ships in the NuGet lib).

Hand-written coverage rises from ~76.6% to ~91.6% (310 tests, all passing).

Follow-up tracked in #259 (deterministic offline codegen drift check on PRs).

🤖 Generated with Claude Code

All changes are test and configuration only, no functional/library behavior changes.

- Add codecov.yml scoped to the LanguageTags library (generated code ignored),
  kept informational until a default-branch upload establishes the baseline.
- Cover the codegen emitters: SaveCodeAsync tests parse the emitted C# with Roslyn
  to assert it is syntactically valid; unit-test LanguageSchema.GetCodeGenString
  including quote escaping.
- Cover LogExtensions LogAndPropagate/LogAndHandle.
- Drop redundant LanguageTagsTests/.editorconfig overrides (IDE0058, IDE0052,
  CS1591); the discard operator already satisfies IDE0058. Keep CA1707 and CA1515
  with rationale comments.
- Add Microsoft.CodeAnalysis.CSharp as a test-only dependency.

Hand-written coverage rises from ~76.6% to ~91.6%.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 11, 2026 01:33
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.43%. Comparing base (be1c95a) to head (689efed).

❗ There is a different number of reports uploaded between BASE (be1c95a) and HEAD (689efed). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (be1c95a) HEAD (689efed)
2 1
Additional details and impacted files
@@             Coverage Diff              @@
##           develop     #260       +/-   ##
============================================
- Coverage    99.76%   87.43%   -12.34%     
============================================
  Files           15       11        -4     
  Lines       232994     1973   -231021     
  Branches       243      243               
============================================
- Hits        232450     1725   -230725     
+ Misses         462      166      -296     
  Partials        82       82               

see 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds additional test coverage and Codecov configuration for the LanguageTags repository, focused on validating codegen emitters and logging helpers, while keeping Codecov reporting scoped to hand-written library code.

Changes:

  • Add Codecov configuration (codecov.yml) to report coverage for the LanguageTags library while ignoring generated code and non-library projects.
  • Add Roslyn-based tests that emit code via SaveCodeAsync(...) and assert the generated output parses without C# syntax errors.
  • Add targeted unit tests for LanguageSchema.GetCodeGenString(...) and logging helpers, plus minor test .editorconfig cleanup.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
LanguageTagsTests/UnM49Tests.cs Adds Roslyn parse-validation coverage for UnM49Data.SaveCodeAsync.
LanguageTagsTests/Rfc5646Tests.cs Adds Roslyn parse-validation coverage for Rfc5646Data.SaveCodeAsync.
LanguageTagsTests/Iso6393Tests.cs Adds Roslyn parse-validation coverage for Iso6393Data.SaveCodeAsync.
LanguageTagsTests/Iso6392Tests.cs Adds Roslyn parse-validation coverage for Iso6392Data.SaveCodeAsync.
LanguageTagsTests/LogExtensionsTests.cs Adds tests for LogExtensions.LogAndPropagate / LogAndHandle.
LanguageTagsTests/LanguageTagsTests.csproj Adds test-only dependency on Microsoft.CodeAnalysis.CSharp.
LanguageTagsTests/LanguageSchemaTests.cs Adds unit coverage for LanguageSchema.GetCodeGenString(...) overloads.
LanguageTagsTests/.editorconfig Removes redundant analyzer suppressions, keeps test-specific CA rules.
Directory.Packages.props Centralizes the Microsoft.CodeAnalysis.CSharp package version.
codecov.yml Adds Codecov settings and ignore rules to scope coverage reporting.

Comment thread codecov.yml
Comment thread LanguageTagsTests/LogExtensionsTests.cs Outdated
Comment thread LanguageTagsTests/Iso6392Tests.cs
- LogExtensions tests now use a capturing ILogger to assert the exception is
  logged at Error level, not just the boolean return value.
- codecov.yml: add an explicit "**/*.g.cs" ignore glob so the config literally
  matches the stated intent (source-generator output was already excluded via
  ".artifacts/**").

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 11, 2026 01:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit ebec6e9 into develop Jul 11, 2026
13 checks passed
@ptr727
ptr727 deleted the test/coverage-and-codecov branch July 11, 2026 01:50
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