Repository navigation
test: cover operator null guards and dangling operator descriptions - #613
Merged
Merged
Conversation
Survivors in the Stryker report (77.21 %) include the ThrowIfNull guards of And/Or/Xor/Not operators and ParenthesisConstraint, and the early return in SetDescription of an operator without right-hand constraint. Add tests for both. Remove the redundant ThrowIfNull(_constraint) in ParenthesisConstraint.IsSatisfiedBy (already guaranteed by the ctor guard, an equivalent mutant).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #613 +/- ##
==========================================
- Coverage 98.54% 98.53% -0.01%
==========================================
Files 22 22
Lines 274 273 -1
Branches 43 43
==========================================
- Hits 270 269 -1
Misses 1 1
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Mutation run 40488160594 reports
MeasurementScopeExtensions.cswith 1 NoCoverage mutant (block removal ofreturn NullScope.Instance;) and 2 surviving statement mutants (ArgumentNullException.ThrowIfNull(logger)andArgumentException.ThrowIfNullOrWhiteSpace(identifier)inStartMeasurement). Log:1 mutants got status NoCoverage,Killed: 16, Survived: 3,final mutation score is 80.00 %. No existing test passesLogLevel.None. (The HTML report is not part of the logs; the third survivor is assumed to be theStopwatch.Stopone from the arithmetic, not verified.)Root cause
The
completionLevel is LogLevel.Nonebranch is never executed. The two guards are only observable on that branch, sinceMeasurementScope's constructor repeats the same checks (same parameter names) for all other levels, so removing them is invisible without aNonetest.Change
Unit tests only, in
MeasurementScopeExtensionsTests.cs:LogLevel.NonereturnsNullScope.Instance; null logger throwsArgumentNullException("logger"); null identifier throwsArgumentNullException("identifier"); empty/whitespace identifier throwsArgumentException("identifier").Before / After
Risk / what this does not change
No production code changes. The
Stopwatch.Stopsurvivor is not addressed. Measured on the branch: https://github.com/dailydevops/logging.measurement/actions/runs/40804802841Run: https://github.com/dailydevops/fluentvalue/actions/runs/40804673608