diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-09-15 11:45:04 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-09-15 11:45:04 -0400 |
| commit | abdfc41f64938dc77a23e35db2768e46e19f6d18 (patch) | |
| tree | 651492ebaf9fd3d90834ca2f1f5499ec1d315480 /slice_test.go | |
| parent | a26dcba10a0d02a2e74784d87d93f5f5e53c5c24 (diff) | |
| download | share-abdfc41f64938dc77a23e35db2768e46e19f6d18.zip | |
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) { |