We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee70938 commit e84fa37Copy full SHA for e84fa37
testscript/cmd.go
@@ -111,6 +111,11 @@ func (ts *TestScript) cmdCmpenv(neg bool, args []string) {
111
112
func (ts *TestScript) doCmdCmp(neg bool, args []string, env bool) {
113
name1, name2 := args[0], args[1]
114
+ if name1 == name2 {
115
+ // It's surprisingly easy to do e.g. `cmp foo.go foo.go` rather than
116
+ // `cmp foo.go foo.go.want`; protect against such obvious cases.
117
+ ts.Fatalf("cmp: comparing the same file twice")
118
+ }
119
text1 := ts.ReadFile(name1)
120
121
absName2 := ts.MkAbs(name2)
0 commit comments