MCPcopy Create free account
hub / github.com/maruel/panicparse / testPanicMismatched

Function testPanicMismatched

stack/context_test.go:1828–1865  ·  view source on GitHub ↗
(t *testing.T, s *Snapshot, b *bytes.Buffer, ppDir string)

Source from the content-addressed store, hash-verified

1826}
1827
1828func testPanicMismatched(t *testing.T, s *Snapshot, b *bytes.Buffer, ppDir string) {
1829 if s.RemoteGOROOT != "" {
1830 t.Fatalf("RemoteGOROOT is %q", s.RemoteGOROOT)
1831 }
1832 if b.String() != "GOTRACEBACK=all\npanic: 42\n\n" {
1833 t.Fatalf("output: %q", b.String())
1834 }
1835 ver := "/v2"
1836 if !internaltest.IsUsingModules() {
1837 ver = ""
1838 }
1839 want := []*Goroutine{
1840 {
1841 Signature: Signature{
1842 State: "running",
1843 Stack: Stack{
1844 Calls: []Call{
1845 newCallLocal(
1846 // This is important to note here that the Go runtime prints out
1847 // the package path, and not the package name.
1848 //
1849 // Here the package name is "correct". There is no way to deduce
1850 // this from the stack trace.
1851 "github.com/maruel/panicparse"+ver+"/cmd/panic/internal/incorrect.Panic",
1852 Args{},
1853 pathJoin(ppDir, "internal", "incorrect", "correct.go"),
1854 7),
1855 newCallLocal("main.init.func20", Args{}, pathJoin(ppDir, "main.go"), 314),
1856 newCallLocal("main.main", Args{}, pathJoin(ppDir, "main.go"), 340),
1857 },
1858 },
1859 },
1860 ID: 1,
1861 First: true,
1862 },
1863 }
1864 similarGoroutines(t, want, s.Goroutines)
1865}
1866
1867func testPanicRace(t *testing.T, s *Snapshot, b *bytes.Buffer, ppDir string) {
1868 if s.RemoteGOROOT != "" {

Callers

nothing calls this directly

Calls 5

IsUsingModulesFunction · 0.92
pathJoinFunction · 0.85
similarGoroutinesFunction · 0.85
newCallLocalFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…