(name, expected, actual string)
| 415 | } |
| 416 | |
| 417 | func 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 | |
| 435 | func runsh(ctx context.Context, path, testDir, tempDir string, zt *ZTest, extraEnv ...string) error { |
| 436 | var stdin io.Reader |
no test coverage detected