aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskar Haarklou Veileborg <ohv1020@hotmail.com>2023-01-12 11:00:26 +0100
committerOskar Haarklou Veileborg <ohv1020@hotmail.com>2023-01-12 11:00:26 +0100
commitbda5726650b18edea367db0fb16a29b9e711e3e2 (patch)
treeab8c4c0cf317173da970218d5970e4ac18bb31a7
parentlist: fix Append & Prepend, remove varargs support (diff)
downloadpds-bda5726650b18edea367db0fb16a29b9e711e3e2.tar.gz
pds-bda5726650b18edea367db0fb16a29b9e711e3e2.tar.xz
Fix random seed for TestRandom
The closure passed to t.Run captured the loop variable which would always be equal to `*randomN` once the tests started running. This meant that all of the runs used the same random seed.
-rw-r--r--immutable_test.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/immutable_test.go b/immutable_test.go
index 9a0de37..581d4d8 100644
--- a/immutable_test.go
+++ b/immutable_test.go
@@ -2495,6 +2495,7 @@ func RunRandom(t *testing.T, name string, fn func(t *testing.T, rand *rand.Rand)
}
t.Run(name, func(t *testing.T) {
for i := 0; i < *randomN; i++ {
+ i := i
t.Run(fmt.Sprintf("%08d", i), func(t *testing.T) {
t.Parallel()
fn(t, rand.New(rand.NewSource(int64(i))))