Skip to content

fix: reject a negative or repeated Within timeout like core does - #160

Merged
vbreuss merged 1 commit into
mainfrom
fix/within-option-validation
Oct 9, 2026
Merged

vbreuss merged 1 commit into
mainfrom
fix/within-option-validation

Conversation

@vbreuss

@vbreuss vbreuss commented Oct 9, 2026

Copy link
Copy Markdown
Member
  • A negative Within(...) timeout now throws ArgumentOutOfRangeException ("The timeout must not be negative.") when the expectation is built, instead of an unrelated CancelAfter error during evaluation. Timeout.InfiniteTimeSpan is still allowed.
  • Calling Within(...) a second time now throws InvalidOperationException ("Within cannot be specified more than once.") instead of silently replacing the first timeout.
  • Messages and check order match aweXpect core's own Within options; regression tests are added.

@vbreuss vbreuss self-assigned this Oct 9, 2026
Copilot AI balanced review requested due to automatic review settings October 9, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Test Results

    8 files  ± 0      8 suites  ±0   54s ⏱️ +2s
  272 tests + 3    271 ✅ + 3  1 💤 ±0  0 ❌ ±0 
1 827 runs  +21  1 826 ✅ +21  1 💤 ±0  0 ❌ ±0 

Results for commit ac1867d. ± Comparison against base commit ceb00e1.

♻️ This comment has been updated with latest results.

A negative timeout only failed later with an unrelated `CancelAfter` error, and a second `Within` silently replaced the first one.

- A negative timeout throws `ArgumentOutOfRangeException` when the expectation is built; `Timeout.InfiniteTimeSpan` is still allowed.
- A second `Within` throws `InvalidOperationException`, with the same wording as core.
@vbreuss
vbreuss force-pushed the fix/within-option-validation branch from d79437d to ac1867d Compare October 9, 2026 16:28
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

👽 Mutation Results

Mutation testing badge

aweXpect.Mockolate

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Runtime Errors Total Detected Total Undetected Total Mutants
Results/AndOrWithinResult.cs 90.00% 9 1 0 0 3 0 0 9 1 13

The final mutation score is 90.00%

Coverage Thresholds: high:80 low:60 break:0

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.5 LTS (Noble Numbat)
AMD EPYC 7763 2.70GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.303
[Host] : .NET 10.0.12 (10.0.12, 10.0.1226.42308), X64 RyuJIT x86-64-v3
DefaultJob : .NET 10.0.12 (10.0.12, 10.0.1226.42308), X64 RyuJIT x86-64-v3

Method Mean Error StdDev Median Allocated
Dummy_aweXpect 0.0007 ns 0.0014 ns 0.0011 ns 0.0 ns -

@vbreuss
vbreuss enabled auto-merge (squash) October 9, 2026 16:31
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@vbreuss
vbreuss merged commit 24160bb into main Oct 9, 2026
13 checks passed
@vbreuss
vbreuss deleted the fix/within-option-validation branch October 9, 2026 16:43
@github-actions

Copy link
Copy Markdown

This is addressed in release v3.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants