diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2023-02-26 12:56:14 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2023-02-26 12:58:50 +0000 |
| commit | b74779ddd5c66419afd0b4a00108d30c7573390e (patch) | |
| tree | 87497756d53c2750c08a25194338ae6404d82497 | |
| parent | ac4ea73cdbf6a25c169dbdce5e46defd56553600 (diff) | |
Clone testing options before calling subtest
| -rw-r--r-- | testing.go | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -15,7 +15,7 @@ import ( // functions, but behaves otherwise like testing.T. type T struct { *testing.T - Options []cmp.Option + Options cmp.Options wg sync.WaitGroup } @@ -135,9 +135,10 @@ func (t *T) Must(b bool) { func (t *T) Run(name string, f func(t *T)) { t.T.Run(name, func(s *testing.T) { - t := &T{T: s, Options: t.Options} - f(t) - t.wg.Wait() + o := &T{T: s, Options: make(cmp.Options, len(t.Options))} + copy(o.Options, t.Options) + f(o) + o.wg.Wait() }) } |
