(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func TestScanSnapshotSynthetic(t *testing.T) { |
| 41 | t.Parallel() |
| 42 | data := []struct { |
| 43 | name string |
| 44 | in []string |
| 45 | prefix string |
| 46 | suffix string |
| 47 | err error |
| 48 | want []*Goroutine |
| 49 | }{ |
| 50 | { |
| 51 | name: "Nothing", |
| 52 | err: io.EOF, |
| 53 | }, |
| 54 | { |
| 55 | name: "NothingEmpty", |
| 56 | in: make([]string, 111), |
| 57 | prefix: strings.Repeat("\n", 110), |
| 58 | err: io.EOF, |
| 59 | }, |
| 60 | { |
| 61 | name: "NothingLong", |
| 62 | in: []string{strings.Repeat("a", bufio.MaxScanTokenSize+10)}, |
| 63 | prefix: strings.Repeat("a", bufio.MaxScanTokenSize+10), |
| 64 | err: io.EOF, |
| 65 | }, |
| 66 | |
| 67 | // One call from main, one from stdlib, one from third party. |
| 68 | // Create a long first line that will be ignored. It is to guard against |
| 69 | // https://github.com/maruel/panicparse/issues/17. |
| 70 | { |
| 71 | name: "long,main,stdlib,third", |
| 72 | in: []string{ |
| 73 | strings.Repeat("a", bufio.MaxScanTokenSize+1), |
| 74 | "panic: reflect.Set: value of type", |
| 75 | "", |
| 76 | "goroutine 1 [running]:", |
| 77 | "github.com/cockroachdb/cockroach/storage/engine._Cfunc_DBIterSeek()", |
| 78 | " ??:0 +0x6d", |
| 79 | "gopkg.in/yaml%2ev2.handleErr(0x433b20)", |
| 80 | "\t/gopath/src/gopkg.in/yaml.v2/yaml.go:153 +0xc6", |
| 81 | "reflect.Value.assignTo(0x570860, 0x803f3e0, 0x15)", |
| 82 | "\t/goroot/src/reflect/value.go:2125 +0x368", |
| 83 | "main.main()", |
| 84 | "\t/gopath/src/github.com/maruel/panicparse/stack/stack.go:428 +0x27", |
| 85 | "", |
| 86 | }, |
| 87 | prefix: strings.Repeat("a", bufio.MaxScanTokenSize+1) + "\npanic: reflect.Set: value of type\n\n", |
| 88 | err: io.EOF, |
| 89 | want: []*Goroutine{ |
| 90 | { |
| 91 | Signature: Signature{ |
| 92 | State: "running", |
| 93 | Stack: Stack{ |
| 94 | Calls: []Call{ |
| 95 | newCall( |
| 96 | "github.com/cockroachdb/cockroach/storage/engine._Cfunc_DBIterSeek", |
| 97 | Args{}, "??", 0), |
nothing calls this directly
no test coverage detected
searching dependent graphs…