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

Function TestAugmentErr

stack/source_test.go:1463–1582  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1461}
1462
1463func TestAugmentErr(t *testing.T) {
1464 t.Parallel()
1465 root, err := os.MkdirTemp("", "stack")
1466 if err != nil {
1467 t.Fatalf("failed to create temporary directory: %v", err)
1468 }
1469 defer func() {
1470 if err2 := os.RemoveAll(root); err2 != nil {
1471 t.Fatalf("failed to remove temporary directory %q: %v", root, err2)
1472 }
1473 }()
1474
1475 tree := map[string]string{
1476 "bad.go": "bad content",
1477 "foo.asm": "; good but ignored",
1478 "good.go": "package main",
1479 "no_access.go": "package main",
1480 }
1481 createTree(t, root, tree)
1482
1483 type dataLine struct {
1484 name string
1485 src string
1486 line int
1487 args Args
1488 errRe string
1489 }
1490 // Note: these tests assumes an OS running in English-US locale. That should
1491 // eventually be fixed, maybe by using regexes?
1492 msgRe := ".+"
1493 if runtime.GOOS != "windows" {
1494 msgRe = "no such file or directory"
1495 }
1496 data := []dataLine{
1497 {
1498 name: "assembly is skipped",
1499 src: "foo.asm",
1500 args: Args{Values: []Arg{{}}},
1501 errRe: regexp.QuoteMeta(fmt.Sprintf("cannot load non-go file %q", filepath.Join(root, "foo.asm"))),
1502 },
1503 {
1504 name: "assembly is skipped (no arg)",
1505 src: "foo.asm",
1506 },
1507 {
1508 name: "invalid line number",
1509 src: "good.go",
1510 line: 2,
1511 args: Args{Values: []Arg{{}}},
1512 errRe: "line 2 is over line count of 1",
1513 },
1514 {
1515 name: "invalid line number (no arg)",
1516 src: "good.go",
1517 line: 2,
1518 },
1519 {
1520 name: "missing file",

Callers

nothing calls this directly

Calls 4

augmentMethod · 0.95
GetGoMinorVersionFunction · 0.92
createTreeFunction · 0.85
compareErrFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…