Skip to content

Commit

Permalink
fix: Test_copyAndReplace
Browse files Browse the repository at this point in the history
  • Loading branch information
dapeng committed May 23, 2024
1 parent 000d74d commit 2c09ffc
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tools/gone/app/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import (
"embed"
"fmt"
"github.com/stretchr/testify/assert"
"io/ioutil"
"os"
"path/filepath"
"testing"
)

func deleteFilesInDirectory(dir string) error {
files, err := ioutil.ReadDir(dir)
files, err := os.ReadDir(dir)
if err != nil {
return fmt.Errorf("failed to read directory: %v", err)
}
Expand All @@ -31,10 +30,8 @@ func deleteFilesInDirectory(dir string) error {
var testF embed.FS

func Test_copyAndReplace(t *testing.T) {
err := deleteFilesInDirectory("testdata/to/")
assert.Nil(t, err)

err = copyAndReplace(testF, "testdata/from", "testdata/to/", map[string]string{
_ = deleteFilesInDirectory("testdata/to/")
err := copyAndReplace(testF, "testdata/from", "testdata/to/", map[string]string{
"test": "x-test",
})
assert.Nil(t, err)
Expand Down

0 comments on commit 2c09ffc

Please sign in to comment.