Skip to content

Commit

Permalink
testscript: only expand second argument to cmpenv (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
myitcv committed Feb 11, 2019
1 parent a2d2540 commit 2ea7272
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion testscript/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ func (ts *TestScript) doCmdCmp(args []string, env bool) {
text2 = string(data)

if env {
text1 = ts.expand(text1)
text2 = ts.expand(text2)
}

Expand Down
4 changes: 2 additions & 2 deletions testscript/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ The predefined commands are:
(If the files have differing content, the failure prints a diff.)
- cmpenv file1 file2
Like cmp, but environment variables are substituted in the file contents
before the comparison. For example, $GOOS is replaced by the target GOOS.
Like cmp, but environment variables in file2 are substituted before the
comparison. For example, $GOOS is replaced by the target GOOS.
- cp src... dst
Copy the listed files to the target file or existing directory.
Expand Down
7 changes: 7 additions & 0 deletions testscript/testdata/cmpenv.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
env $=$
cmpenv file1 file2

-- file1 --
$i
-- file2 --
$$i

0 comments on commit 2ea7272

Please sign in to comment.