Added basic i18n
This commit is contained in:
31
i18n/race_test.go
Normal file
31
i18n/race_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package i18n
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLoadKeysRace(t *testing.T) {
|
||||
// Reset shared global state so the test starts clean
|
||||
LangPacks = map[string]LangPack{}
|
||||
|
||||
const goroutines = 200
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(goroutines)
|
||||
|
||||
start := make(chan struct{})
|
||||
|
||||
for i := 0; i < goroutines; i++ {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
<-start
|
||||
_, _ = LoadKeys("en")
|
||||
}()
|
||||
}
|
||||
|
||||
// Release all goroutines at once to maximize overlap
|
||||
close(start)
|
||||
wg.Wait()
|
||||
}
|
||||
Reference in New Issue
Block a user