summaryrefslogtreecommitdiffstats
path: root/slice_test.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2025-09-15 11:45:04 -0400
committerSam Anthony <sam@samanthony.xyz>2025-09-15 11:45:04 -0400
commitabdfc41f64938dc77a23e35db2768e46e19f6d18 (patch)
tree651492ebaf9fd3d90834ca2f1f5499ec1d315480 /slice_test.go
parenta26dcba10a0d02a2e74784d87d93f5f5e53c5c24 (diff)
downloadshare-abdfc41f64938dc77a23e35db2768e46e19f6d18.zip
Diffstat (limited to 'slice_test.go')
-rw-r--r--slice_test.go14
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) {