(after time.Duration)
| 2140 | } |
| 2141 | |
| 2142 | func timeout(after time.Duration) (cancel func()) { |
| 2143 | if isRaceTest { |
| 2144 | return func() {} |
| 2145 | } |
| 2146 | c := time.After(after) |
| 2147 | cc := make(chan struct{}) |
| 2148 | go func() { |
| 2149 | select { |
| 2150 | case <-cc: |
| 2151 | return |
| 2152 | case <-c: |
| 2153 | buf := make([]byte, 1<<20) |
| 2154 | stacklen := runtime.Stack(buf, true) |
| 2155 | log.Printf("=== Timeout, assuming deadlock ===\n*** goroutine dump...\n%s\n*** end\n", string(buf[:stacklen])) |
| 2156 | os.Exit(2) |
| 2157 | } |
| 2158 | }() |
| 2159 | return func() { |
| 2160 | close(cc) |
| 2161 | } |
| 2162 | } |
| 2163 | |
| 2164 | func TestWithDecodeAllCapLimit(t *testing.T) { |
| 2165 | var encs []*Encoder |
no outgoing calls
no test coverage detected
searching dependent graphs…