MCPcopy Index your code
hub / github.com/maruel/panicparse / testAugmentCommon

Function testAugmentCommon

stack/source_test.go:1422–1461  ·  view source on GitHub ↗
(t *testing.T, content []byte, mayBeInlined bool, want Stack)

Source from the content-addressed store, hash-verified

1420}
1421
1422func testAugmentCommon(t *testing.T, content []byte, mayBeInlined bool, want Stack) {
1423 // Analyze it.
1424 prefix := bytes.Buffer{}
1425 s, suffix, err := ScanSnapshot(bytes.NewBuffer(content), &prefix, defaultOpts())
1426 if err != nil {
1427 t.Fatalf("failed to parse input: %v", err)
1428 }
1429 if got := prefix.String(); got != "panic: ooh\n\n" {
1430 t.Fatalf("Unexpected panic output:\n%#v", got)
1431 }
1432 compareString(t, "exit status 2\n", string(suffix))
1433 if !s.guessPaths() {
1434 t.Error("expected success")
1435 }
1436
1437 if err := s.augment(); err != nil {
1438 t.Errorf("augment() returned %v", err)
1439 }
1440 got := s.Goroutines[0].Signature.Stack
1441 zapPointers(t, &want, &got)
1442
1443 // With a non-pointer method, elided argument can be shown. It's only for
1444 // test case "non-pointer method".
1445 if mayBeInlined {
1446 for j := range got.Calls {
1447 if !want.Calls[j].Args.Elided {
1448 got.Calls[j].Args.Elided = false
1449 }
1450 if got.Calls[j].Args.Values == nil {
1451 want.Calls[j].Args.Values = nil
1452 }
1453 }
1454 }
1455
1456 if diff := cmp.Diff(want, got); diff != "" {
1457 t.Logf("Different (-want +got):\n%s", diff)
1458 t.Logf("Output:\n%s", content)
1459 t.FailNow()
1460 }
1461}
1462
1463func TestAugmentErr(t *testing.T) {
1464 t.Parallel()

Callers 1

TestAugmentFunction · 0.85

Calls 7

ScanSnapshotFunction · 0.85
defaultOptsFunction · 0.85
zapPointersFunction · 0.85
guessPathsMethod · 0.80
augmentMethod · 0.80
compareStringFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…