forked from mirror/cobra
cmd: Add "-u" to output unified diff in golden tests
This commit is contained in:
parent
cb9cf94690
commit
75c6acfc8f
|
@ -39,11 +39,11 @@ func compareFiles(pathA, pathB string) error {
|
||||||
// Don't execute diff if it can't be found.
|
// Don't execute diff if it can't be found.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
diffCmd := exec.Command(diffPath, pathA, pathB)
|
diffCmd := exec.Command(diffPath, "-u", pathA, pathB)
|
||||||
diffCmd.Stdout = output
|
diffCmd.Stdout = output
|
||||||
diffCmd.Stderr = output
|
diffCmd.Stderr = output
|
||||||
|
|
||||||
output.WriteString("$ diff " + pathA + " " + pathB + "\n")
|
output.WriteString("$ diff -u " + pathA + " " + pathB + "\n")
|
||||||
if err := diffCmd.Run(); err != nil {
|
if err := diffCmd.Run(); err != nil {
|
||||||
output.WriteString("\n" + err.Error())
|
output.WriteString("\n" + err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue