timecop

package
v0.176.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const BlazingFast = 100
View Source
const DeepFreeze = deepFreeze(1)

DeepFreeze is a Travel TravelOption, and it instruct travel to freeze the time wherever it lands after the travelling. It is a stronger level of freezing, and will force tickers and timers to also halt immedietly.

View Source
const Freeze = freeze(0)

Freeze is a Travel TravelOption, and it instruct travel to freeze the time wherever it lands after the travelling..

View Source
const Unfreeze = unfreeze(0)

Unfreeze is a Travel TravelOption, and it instruct travel that after the time travelling, the flow of time should continue.

Variables

This section is empty.

Functions

func SetSpeed

func SetSpeed(tb testing.TB, multiplier float64)

func Travel

func Travel[D time.Duration | time.Time](tb testing.TB, d D, tos ...TravelOption)

Travel will initiate a time travel. It accepts either a time duration as argument to set the travel's duration, or a given target time if we need to travel to a specific point in time. It accepts optional travel options such as timecop.Freeze and timecop.DeepFreeze.

Types

type TravelOption

type TravelOption interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL