Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fix ¶
func Fix(t interface{ Cleanup(func()) }, v string)
Fix makes Generate return v until t and its subtests finish, then puts back the backend it replaced. Calls nest: an inner Fix gives back the outer one when its test ends. The backend is process-global, so a test that calls Fix must not run in parallel with one that generates UUIDs.
func Generate ¶
func Generate() string
Generate returns a new UUID v4 from the package's backend. Use it rather than the uuid package directly, so a test can make identifiers deterministic.
func Parse ¶ added in v0.24.1
Parse reads a UUID from its string form. It does not go through the backend: parsing has no behaviour worth substituting in a test.
func Set ¶
func Set(t interface{ Cleanup(func()) }, u UUID)
Set serves Generate from u until t and its subtests finish, then puts back the backend it replaced. Use it when a test needs Generate to vary; Fix covers a single value. Like Fix, it swaps a process-global backend and is not safe under t.Parallel.