File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"bytes"
5
+ "io"
5
6
"io/ioutil"
6
7
"os"
7
8
"path"
@@ -103,7 +104,20 @@ func (h *harness) testdataFile(name string) string {
103
104
workingDir , err := os .Getwd ()
104
105
require .NoError (h .t , err )
105
106
106
- return path .Join (workingDir , "testdata" , name )
107
+ origFile := path .Join (workingDir , "testdata" , name )
108
+
109
+ fileCopy := path .Join (h .t .TempDir (), name )
110
+
111
+ src , err := os .Open (origFile )
112
+ require .NoError (h .t , err )
113
+ defer src .Close ()
114
+ dst , err := os .Create (fileCopy )
115
+ require .NoError (h .t , err )
116
+ defer dst .Close ()
117
+ _ , err = io .Copy (dst , src )
118
+ require .NoError (h .t , err )
119
+
120
+ return fileCopy
107
121
}
108
122
109
123
func (h * harness ) tempFile (name string ) string {
You can’t perform that action at this time.
0 commit comments