diff options
Diffstat (limited to 'slice_test.go')
| -rw-r--r-- | slice_test.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/slice_test.go b/slice_test.go index bdb6267..af44eaf 100644 --- a/slice_test.go +++ b/slice_test.go @@ -1,6 +1,7 @@ package share_test import ( + "sync" "testing" "github.com/sam-rba/share" @@ -8,12 +9,21 @@ import ( func TestConstSlice(t *testing.T) { orig := []string{"foo", "bar", "baz"} + shared := share.NewConstSlice(orig) - verifySameSlice(shared, orig, t) + defer shared.Close() + + var wg sync.WaitGroup + wg.Add(2) + go func() { + verifySameSlice(shared, orig, t) + wg.Done() + }() go func() { - defer shared.Close() verifySameSlice(shared, orig, t) + wg.Done() }() + wg.Wait() } func verifySameSlice[T comparable](cs share.ConstSlice[T], s []T, t *testing.T) { |