File tree 2 files changed +2
-24
lines changed
2 files changed +2
-24
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import (
21
21
"github.com/numtide/treefmt/stats"
22
22
"github.com/numtide/treefmt/test"
23
23
"github.com/numtide/treefmt/walk"
24
+ cp "github.com/otiai10/copy"
24
25
"github.com/stretchr/testify/require"
25
26
)
26
27
@@ -933,9 +934,7 @@ func TestCacheBusting(t *testing.T) {
933
934
as .NoError (os .Mkdir (binPath , 0o755 ))
934
935
935
936
scriptPath := filepath .Join (binPath , "test-fmt-append" )
936
-
937
- test .CopyFile (t , sourcePath , scriptPath )
938
- as .NoError (os .Chmod (scriptPath , 0o755 ))
937
+ as .NoError (cp .Copy (sourcePath , scriptPath , cp.Options {AddPermission : 0o755 }))
939
938
940
939
// prepend our test bin directory to PATH
941
940
t .Setenv ("PATH" , binPath + ":" + os .Getenv ("PATH" ))
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package test
2
2
3
3
import (
4
4
"fmt"
5
- "io"
6
5
"os"
7
6
"path/filepath"
8
7
"testing"
@@ -124,23 +123,3 @@ func ChangeWorkDir(t *testing.T, dir string) {
124
123
t .Fatal (fmt .Errorf ("failed to change working directory to %s: %w" , dir , err ))
125
124
}
126
125
}
127
-
128
- func CopyFile (t * testing.T , sourcePath string , destPath string ) {
129
- t .Helper ()
130
-
131
- source , err := os .Open (sourcePath )
132
- if err != nil {
133
- t .Fatal (err , fmt .Sprintf ("failed to open %s" , sourcePath ))
134
- }
135
- defer source .Close ()
136
-
137
- dest , err := os .Create (destPath )
138
- if err != nil {
139
- t .Fatal (err , fmt .Sprintf ("failed to create %s" , sourcePath ))
140
- }
141
- defer dest .Close ()
142
-
143
- if _ , err = io .Copy (dest , source ); err != nil {
144
- t .Fatal (err , fmt .Sprintf ("failed to copy %s to %s" , sourcePath , destPath ))
145
- }
146
- }
You can’t perform that action at this time.
0 commit comments