From abdfc41f64938dc77a23e35db2768e46e19f6d18 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Mon, 15 Sep 2025 11:45:04 -0400 Subject: deque --- slice_test.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'slice_test.go') 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) { -- cgit v1.2.3