diff options
Diffstat (limited to 'db/db_test.go')
| -rw-r--r-- | db/db_test.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/db/db_test.go b/db/db_test.go index 966ce85..15c62a3 100644 --- a/db/db_test.go +++ b/db/db_test.go @@ -7,16 +7,12 @@ import ( "fmt" "os" "path" + "slices" "testing" ) func stringsContain(haystack []string, needle string) bool { - for _, s := range haystack { - if s == needle { - return true - } - } - return false + return slices.Contains(haystack, needle) } func TestOpenPathNotSet(t *testing.T) { @@ -386,7 +382,7 @@ func TestConcurrentWrites(t *testing.T) { // Randomly create a some entries. numEntries := 1000 entries := make([]string, 0) - for i := 0; i < numEntries; i++ { + for i := range numEntries { entries = append(entries, fmt.Sprintf("entry-%d", i)) } @@ -402,7 +398,7 @@ func TestConcurrentWrites(t *testing.T) { donec := make(chan int) feed := "npr" routines := 5 - for i := 0; i < routines; i++ { + for range routines { go addEntries(db, feed, entries, donec) } routinesDone := 0 |
