@@ -15,17 +15,13 @@ func TestZipFolder(t *testing.T) {
1515 }
1616 defer os .RemoveAll (tempDir )
1717
18- t .Logf ("DEBUG: Created temp dir: %s" , tempDir )
19-
2018 // Create a test folder inside temp dir
2119 testFolder := filepath .Join (tempDir , "testfolder" )
22- err = os .Mkdir (testFolder , 0755 )
23- if err != nil {
20+ if err := os .Mkdir (testFolder , 0755 ); err != nil {
2421 t .Fatalf ("Failed to create test folder: %v" , err )
2522 }
26- t .Logf ("DEBUG: Created test folder: %s" , testFolder )
2723
28- // Create some test files
24+ // Create test files
2925 testFiles := []struct {
3026 name string
3127 content string
@@ -37,11 +33,9 @@ func TestZipFolder(t *testing.T) {
3733
3834 for _ , tf := range testFiles {
3935 filePath := filepath .Join (testFolder , tf .name )
40- err = os .WriteFile (filePath , []byte (tf .content ), 0644 )
41- if err != nil {
36+ if err := os .WriteFile (filePath , []byte (tf .content ), 0644 ); err != nil {
4237 t .Fatalf ("Failed to create test file %s: %v" , tf .name , err )
4338 }
44- t .Logf ("DEBUG: Created test file: %s" , filePath )
4539 }
4640
4741 // Change to temp dir so the zip is created there
@@ -51,25 +45,21 @@ func TestZipFolder(t *testing.T) {
5145 }
5246 defer os .Chdir (originalDir )
5347
54- err = os .Chdir (tempDir )
55- if err != nil {
48+ if err := os .Chdir (tempDir ); err != nil {
5649 t .Fatalf ("Failed to change to temp dir: %v" , err )
5750 }
58- t .Logf ("DEBUG: Changed to dir: %s" , tempDir )
5951
6052 // Call ZipFolder with the relative path
6153 zipName , err := ZipFolder ("testfolder" )
6254 if err != nil {
6355 t .Fatalf ("ZipFolder failed: %v" , err )
6456 }
65- t .Logf ("DEBUG: Created zip file: %s" , zipName )
6657
6758 // Verify the zip file was created
6859 zipPath := filepath .Join (tempDir , zipName )
6960 if _ , err := os .Stat (zipPath ); os .IsNotExist (err ) {
7061 t .Fatalf ("Zip file was not created at %s" , zipPath )
7162 }
72- t .Logf ("DEBUG: Verified zip exists at: %s" , zipPath )
7363
7464 // Open and verify the zip contents
7565 reader , err := zip .OpenReader (zipPath )
@@ -78,16 +68,7 @@ func TestZipFolder(t *testing.T) {
7868 }
7969 defer reader .Close ()
8070
81- t .Logf ("DEBUG: Zip contains %d files" , len (reader .File ))
82- for _ , f := range reader .File {
83- t .Logf ("DEBUG: Zip entry: %s (size: %d)" , f .Name , f .UncompressedSize64 )
84- }
85-
86- // Verify all test files are in the zip
8771 if len (reader .File ) != len (testFiles ) {
8872 t .Errorf ("Expected %d files in zip, got %d" , len (testFiles ), len (reader .File ))
8973 }
90-
91- // Cleanup the zip file
92- os .Remove (zipPath )
9374}
0 commit comments