Registry / testing / prashantv-gostub

prashantv-gostub

JSON →
library1.1.0gogounverified

Package gostub is used for stubbing variables in tests, and resetting the original value once the test has been run.

go get github.com/prashantv/gostub
INSTALL
IMPORT
SIG · PRASHANTV-GOSTUB
P
prashantv-gostub
testinggov1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gostub
github.com/prashantv/gostub

Stubs the timeNow function to return a fixed value and resets it after use.

package main import ( "fmt" "github.com/prashantv/gostub" ) var timeNow = func() int64 { return 0 } func main() { stubs := gostub.Stub(&timeNow, func() int64 { return 1234567890 }) defer stubs.Reset() fmt.Println(timeNow()) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.1.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
prashantv-gostub — go get prashantv-gostub · libregistry