Skip to content

String Inspection Guards#154

Merged
feO2x merged 3 commits into
mainfrom
153-string-inspection-guards
Jul 14, 2026
Merged

String Inspection Guards#154
feO2x merged 3 commits into
mainfrom
153-string-inspection-guards

Conversation

@feO2x

@feO2x feO2x commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Closes #153

Also upgrades xunit to v3, introduces Microsoft.Testing.Platform v2 and enabled code coverage reporting in GitHub Actions.

feO2x added 3 commits July 14, 2026 18:19
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
…n CI

Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
@feO2x
feO2x requested a review from Copilot July 14, 2026 17:42
@feO2x feO2x self-assigned this Jul 14, 2026
@feO2x feO2x linked an issue Jul 14, 2026 that may be closed by this pull request
18 tasks
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Complexity Health
Light.GuardClauses 87% 84% 2336
Light.GuardClauses.InternalRoslynAnalyzers 96% 86% 52
Light.GuardClauses.InternalRoslynAnalyzers.CodeFixes 95% 100% 8
Light.GuardClauses.SourceCodeTransformation 92% 83% 663
Summary 89% (4186 / 4715) 84% (2316 / 2757) 3059

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 a new family of allocation-free string inspection predicates and fluent throwing guards (digits, letters-or-digits, casing, Base64, hex, and whitespace) across string, span, and memory receiver shapes, aligned with the library’s existing assertion patterns and source-export distribution model. The PR also updates the test/tooling stack to xUnit v3 on Microsoft Testing Platform and enables CI code coverage reporting.

Changes:

  • Introduces string-inspection predicates (ContainsOnlyDigits, ContainsOnlyLettersOrDigits, IsUpperCase, IsLowerCase, IsBase64, IsHexadecimal) and guards (Must* variants plus MustNotContainWhiteSpace) for all required receiver shapes.
  • Aligns MustBeAscii character-sequence overloads to throw StringException for invalid non-null string content (keeping scalar/byte overload behavior unchanged).
  • Updates tests, source-export whitelist plumbing, benchmarks, docs, and GitHub Actions to support xUnit v3 + Microsoft Testing Platform with coverage artifacts and PR coverage comments.

Reviewed changes

Copilot reviewed 36 out of 37 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs Ensures Net10 single-file exports include required framework usings for new Base64 APIs.
tools/source-export/Light.GuardClauses.SourceCodeTransformation/settings.json Adds new string-inspection assertion families to the source-export whitelist settings.
tools/source-export/Light.GuardClauses.SourceCodeTransformation/AssertionWhitelist.cs Extends whitelist model with entries for the new predicates/guards.
src/Light.GuardClauses/ExceptionFactory/Throw.InvalidStringContent.cs Adds a centralized helper for throwing StringException for invalid string content.
src/Light.GuardClauses/Check.MustNotContainWhiteSpace.cs Adds throwing-only whitespace rejection guard across all receiver shapes.
src/Light.GuardClauses/Check.MustContainOnlyLettersOrDigits.cs Adds guard requiring Unicode letter-or-digit content across all receiver shapes.
src/Light.GuardClauses/Check.MustContainOnlyDigits.cs Adds guard requiring Unicode digit content across all receiver shapes.
src/Light.GuardClauses/Check.MustBeUpperCase.cs Adds guard requiring absence of Unicode lowercase characters across all receiver shapes.
src/Light.GuardClauses/Check.MustBeLowerCase.cs Adds guard requiring absence of Unicode uppercase characters across all receiver shapes.
src/Light.GuardClauses/Check.MustBeHexadecimal.cs Adds guard requiring ASCII hex content across all receiver shapes.
src/Light.GuardClauses/Check.MustBeBase64.cs Adds guard requiring structurally valid standard Base64 across all receiver shapes.
src/Light.GuardClauses/Check.MustBeAscii.cs Updates character-sequence MustBeAscii to throw StringException for invalid non-null content and refreshes XML docs.
src/Light.GuardClauses/Check.IsUpperCase.cs Adds casing predicate (no lowercase chars) across all receiver shapes.
src/Light.GuardClauses/Check.IsLowerCase.cs Adds casing predicate (no uppercase chars) across all receiver shapes.
src/Light.GuardClauses/Check.IsHexadecimal.cs Adds hex predicate with Net10 fast-path (char.IsAsciiHexDigit) and portable fallback.
src/Light.GuardClauses/Check.IsBase64.cs Adds Base64 predicate using Net10 Base64.IsValid and a portable validator fallback.
src/Light.GuardClauses/Check.ContainsOnlyLettersOrDigits.cs Adds Unicode alphanumeric predicate across all receiver shapes.
src/Light.GuardClauses/Check.ContainsOnlyDigits.cs Adds Unicode digit predicate across all receiver shapes.
tests/Directory.Build.props Migrates test projects to Microsoft Testing Platform runner and enables TRX + coverage extensions.
tests/Light.GuardClauses.Tests/Test.cs Updates test helper imports for xUnit v3 usage.
tests/Light.GuardClauses.Tests/StringAssertions/StringInspectionPredicateTests.cs Adds conformance tests for predicate semantics + Base64 portability differential tests.
tests/Light.GuardClauses.Tests/StringAssertions/StringInspectionGuardTests.cs Adds conformance tests for guard return-shape, null/invalid behavior, and custom factories.
tests/Light.GuardClauses.Tests/StringAssertions/OrdinalIgnoreWhiteSpaceComparerTests.cs Updates output helper null-guard usage for new CallerArgumentExpression behavior.
tests/Light.GuardClauses.Tests/StringAssertions/OrdinalIgnoreCaseIgnoreWhiteSpaceComparerTests.cs Updates output helper null-guard usage for new CallerArgumentExpression behavior.
tests/Light.GuardClauses.Tests/StringAssertions/AsciiTests.cs Updates expectations for MustBeAscii string/span/memory exception behavior (StringException).
tests/Light.GuardClauses.Tests/DefaultVariablesData.cs Updates custom data attribute for xUnit v3 discovery/data-row model (currently contains a compile error).
tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerWhitelistTests.cs Adds whitelist reachability/trimming tests for new string-inspection families and portable Base64 validator.
tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerFrameworkTests.cs Extends framework-conditional export tests to validate Net10 vs NetStandard Base64/hex compilation output.
tests/Light.GuardClauses.SourceCodeTransformation.Tests/ParseCSharpFilesWithRoslynTests.cs Updates Roslyn parse calls to use the test cancellation token.
benchmarks/Light.GuardClauses.Performance/StringAssertions/StringInspectionBenchmark.cs Adds microbenchmarks for new predicates/guards (digits, alphanumeric, Base64, whitespace).
docs/contributing-and-building.md Updates local build/test instructions for Microsoft Testing Platform and coverage flags.
docs/assertion-overview.md Documents the new string-inspection predicates/guards and their semantics.
Directory.Packages.props Updates central package versions (BenchmarkDotNet/FluentAssertions) and switches to MTP + xUnit v3 packages.
global.json Declares Microsoft Testing Platform as the test runner in repo configuration.
ai-plans/0153-string-inspection-guards.md Adds the implementation plan/acceptance-criteria checklist for issue #153.
.github/workflows/build-and-test.yml Updates CI triggers, runs tests with coverage, produces coverage artifacts, and posts a sticky PR coverage comment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/Light.GuardClauses.Tests/DefaultVariablesData.cs
@feO2x
feO2x merged commit 46bbe62 into main Jul 14, 2026
3 checks passed
@feO2x
feO2x deleted the 153-string-inspection-guards branch July 14, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String Inspection Guards

2 participants