cats-effect icon indicating copy to clipboard operation
cats-effect copied to clipboard

testkit: add setTime and advanceTo methods to TestControl

Open najuna-brian opened this issue 2 months ago • 1 comments

Description

Adds binary-compatible methods for setting absolute time in TestControl:

  • setTime(targetTime): Sets clock to specified absolute time
  • advanceTo(targetTime): Alias for setTime with descriptive name

Both methods fail with IllegalArgumentException if target time is before current time. Fixes the need for absolute time setting in TestControl, complementing the existing incremental advance() methods.

Why This Approach

This addresses the binary compatibility concerns raised in #4506 by adding new methods instead of modifying existing method signatures. Provides the same functionality as the clockStart parameter approach but maintains backward compatibility.

Refs #3309

najuna-brian avatar Oct 16 '25 20:10 najuna-brian

Hi @armanbilge, @samspills

Please have a look at this when you have some time and guide accordingly. Thank you :blush:

najuna-brian avatar Oct 17 '25 05:10 najuna-brian