(t *testing.T)
| 42 | } |
| 43 | |
| 44 | func TestGetFilesCount(t *testing.T) { |
| 45 | name, err := os.MkdirTemp("/tmp", t.Name()) |
| 46 | if err != nil { |
| 47 | t.Error(err) |
| 48 | } |
| 49 | defer os.RemoveAll(name) |
| 50 | |
| 51 | checkFileCount(t, name, 0) |
| 52 | |
| 53 | nameInside, err := os.MkdirTemp(name, "") |
| 54 | if err != nil { |
| 55 | t.Error(err) |
| 56 | } |
| 57 | |
| 58 | checkFileCount(t, name, 0) |
| 59 | |
| 60 | mkFile(t, name) |
| 61 | checkFileCount(t, name, 1) |
| 62 | |
| 63 | mkFile(t, nameInside) |
| 64 | checkFileCount(t, name, 2) |
| 65 | } |
| 66 | |
| 67 | func mkFile(t *testing.T, dir string) { |
| 68 | f, err := os.Create(path.Join(dir, "file.txt")) |
nothing calls this directly
no test coverage detected