-
Notifications
You must be signed in to change notification settings - Fork 44
/
cache_test.go
52 lines (41 loc) · 1.04 KB
/
cache_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package form
import (
"reflect"
"testing"
. "github.com/go-playground/assert/v2"
)
// NOTES:
// - Run "go test" to run tests
// - Run "gocov test | gocov report" to report on test converage by file
// - Run "gocov test | gocov annotate -" to report on all code and functions, those ,marked with "MISS" were never called
//
// or
//
// -- may be a good idea to change to output path to somewherelike /tmp
// go test -coverprofile cover.out && go tool cover -html=cover.out -o cover.html
//
//
// go test -cpuprofile cpu.out
// ./validator.test -test.bench=. -test.cpuprofile=cpu.prof
// go tool pprof validator.test cpu.prof
//
//
// go test -memprofile mem.out
func TestDecoderMultipleSimultaniousParseStructRequests(t *testing.T) {
sc := newStructCacheMap()
type Struct struct {
Array []int
}
proceed := make(chan struct{})
var test Struct
sv := reflect.ValueOf(test)
typ := sv.Type()
for i := 0; i < 200; i++ {
go func() {
<-proceed
s := sc.parseStruct(ModeImplicit, sv, typ, "form")
NotEqual(t, s, nil)
}()
}
close(proceed)
}