MCPcopy Create free account
hub / github.com/brimdata/super / diffErr

Function diffErr

ztest/ztest.go:417–433  ·  view source on GitHub ↗
(name, expected, actual string)

Source from the content-addressed store, hash-verified

415}
416
417func diffErr(name, expected, actual string) error {
418 if !utf8.ValidString(expected) {
419 expected = hex.Dump([]byte(expected))
420 actual = hex.Dump([]byte(actual))
421 }
422 diff, err := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{
423 A: difflib.SplitLines(expected),
424 FromFile: "expected",
425 B: difflib.SplitLines(actual),
426 ToFile: "actual",
427 Context: 5,
428 })
429 if err != nil {
430 panic("ztest: " + err.Error())
431 }
432 return fmt.Errorf("expected and actual %s differ:\n%s", name, diff)
433}
434
435func runsh(ctx context.Context, path, testDir, tempDir string, zt *ZTest, extraEnv ...string) error {
436 var stdin io.Reader

Callers 2

diffInternalMethod · 0.85
runshFunction · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected