mirror of
https://github.com/jimeh/go-mocktesting.git
synced 2026-02-19 11:56:39 +00:00
feat(mocktesting): initial implementation
This commit is contained in:
30
mocktesting_test.go
Normal file
30
mocktesting_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package mocktesting
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
func runInGoroutine(f func()) {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
f()
|
||||
}()
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func stringsUniq(strs []string) []string {
|
||||
m := map[string]bool{}
|
||||
|
||||
for _, s := range strs {
|
||||
m[s] = true
|
||||
}
|
||||
|
||||
r := make([]string, 0, len(m))
|
||||
for s := range m {
|
||||
r = append(r, s)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
Reference in New Issue
Block a user