Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kaatinga committed Mar 26, 2024
1 parent 6376403 commit 1c4b193
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions models_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,21 @@ func TestCrusoe_Get_Int(t *testing.T) {
t.Errorf("strange cache type returned: %T", crusoe)
}

wg := sync.WaitGroup{}
for i := 0; i < 2; i++ {
wg.Add(1)
go func(i int) {
for _, scenario := range tests {
t.Run(fmt.Sprintf("%T %[1]v, loop %d", scenario.value, i), func(t *testing.T) {
crusoe.Set(scenario.value)
_ = crusoe.Get()
})
}
}(i)
}

for _, scenario := range tests {
t.Run(fmt.Sprintf("%T %[1]v", scenario.value), func(t *testing.T) {
crusoe.Set(scenario.value)
cacheValue := crusoe.Get()
if cacheValue != scenario.value {
t.Errorf("strange value returned: %v", cacheValue)
}
})
wg.Done()
}(i)
}
wg.Wait()

t.Run("get the last value", func(t *testing.T) {
cacheValue := crusoe.Get()
Expand Down

0 comments on commit 1c4b193

Please sign in to comment.