AnyOf
Align the AnyOf
assertion helper with other existing assertion helper functions in the assert package.
The new approach should be idiomatic with the rest of the assert package and more convenient.
assert.AnyOf(tb, func(a *assert.A) {
a.Case(func(it assert.It) {
it.Must.True(outcome)
})
a.Case(func(it assert.It) {
it.Must.False(outcome)
})
})
random.Unique
Introduce a random.Unique
utility function to simplify the generation of unique random values in tests,
reducing the risk of flaky test results where an assertion expects district values from two randomly made input
rnd := random.New(random.CryptoSeed{})
v1 := rnd.Int()
v2 := random.Unique(rnd.Int, v1)
v3 := random.Unique(rnd.Int, v1, v2)
Breaking changes
assert.AnyOf -> assert.A
To fix your codebase, run the following shell script (GNU coreutils)
find . -type f -name "*.go" -exec sed -i'' -e 's/assert\.AnyOf)/assert.A)/g' {} \;