From 6cd3dea2697e73ae2612f3e169f428fd68f9539b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammed=20Efe=20=C3=87etin?= Date: Tue, 18 Apr 2023 19:14:14 +0300 Subject: [PATCH] update --- file_test.go | 63 ---------------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 file_test.go diff --git a/file_test.go b/file_test.go deleted file mode 100644 index 4098156..0000000 --- a/file_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package utils - -import ( - "io/fs" - "net/http" - "os" - "testing" -) - -func Test_ReadFile(t *testing.T) { - t.Parallel() - - testFS := http.FS(os.DirFS(".github/tests")) - file, err := ReadFile("john.txt", testFS) - - AssertEqual(t, string(file), "doe\n") - AssertEqual(t, err, nil) -} - -func Test_Walk(t *testing.T) { - t.Parallel() - - type file struct { - path string - name string - isDir bool - } - var files []file - - neededResults := []file{ - { - path: "example", - name: "example", - isDir: true, - }, - { - path: "example/example1.txt", - name: "example1.txt", - isDir: false, - }, - { - path: "john.txt", - name: "john.txt", - isDir: false, - }, - } - - testFS := http.FS(os.DirFS(".github/tests")) - err := Walk(testFS, ".", func(path string, info fs.FileInfo, err error) error { - if path != "." { - files = append(files, file{ - path: path, - name: info.Name(), - isDir: info.IsDir(), - }) - } - - return nil - }) - - AssertEqual(t, err, nil) - AssertEqual(t, files, neededResults) -}