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
22
33import (
44 "bytes"
5+ "io"
56 "io/ioutil"
67 "os"
78 "path"
@@ -103,7 +104,20 @@ func (h *harness) testdataFile(name string) string {
103104 workingDir , err := os .Getwd ()
104105 require .NoError (h .t , err )
105106
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
107121}
108122
109123func (h * harness ) tempFile (name string ) string {
You can’t perform that action at this time.
0 commit comments