(t *testing.T, zipPath string, files map[string]string)
| 9 | ) |
| 10 | |
| 11 | func createZip(t *testing.T, zipPath string, files map[string]string) { |
| 12 | out, err := os.Create(zipPath) |
| 13 | if err != nil { |
| 14 | t.Fatal(err) |
| 15 | } |
| 16 | defer out.Close() |
| 17 | |
| 18 | zipWriter := zip.NewWriter(out) |
| 19 | defer zipWriter.Close() |
| 20 | |
| 21 | for name, content := range files { |
| 22 | w, err := zipWriter.Create(name) |
| 23 | if err != nil { |
| 24 | t.Fatal(err) |
| 25 | } |
| 26 | if _, err := w.Write([]byte(content)); err != nil { |
| 27 | t.Fatal(err) |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | func TestUnzip_Success(t *testing.T) { |
| 33 | tmpDir := t.TempDir() |
no test coverage detected