Skip to content

Commit 2ea7272

Browse files
authored
testscript: only expand second argument to cmpenv (#53)
1 parent a2d2540 commit 2ea7272

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

testscript/cmd.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ func (ts *TestScript) doCmdCmp(args []string, env bool) {
133133
text2 = string(data)
134134

135135
if env {
136-
text1 = ts.expand(text1)
137136
text2 = ts.expand(text2)
138137
}
139138

testscript/doc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ The predefined commands are:
128128
(If the files have differing content, the failure prints a diff.)
129129
130130
- cmpenv file1 file2
131-
Like cmp, but environment variables are substituted in the file contents
132-
before the comparison. For example, $GOOS is replaced by the target GOOS.
131+
Like cmp, but environment variables in file2 are substituted before the
132+
comparison. For example, $GOOS is replaced by the target GOOS.
133133
134134
- cp src... dst
135135
Copy the listed files to the target file or existing directory.

testscript/testdata/cmpenv.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
env $=$
2+
cmpenv file1 file2
3+
4+
-- file1 --
5+
$i
6+
-- file2 --
7+
$$i

0 commit comments

Comments
 (0)