package archiver import ( "context" "testing" "gitea.loveuer.com/yizhisec/pkg3/logger" ) func TestDownloadAndExtract(t *testing.T) { logger.SetLogLevel(logger.LogLevelDebug) ctx := context.Background() // Example: download and extract a tar.gz file err := DownloadAndExtract( ctx, "https://example.com/archive.tar.gz", "/tmp/test-extract", WithInsecureSkipVerify(), ) if err != nil { t.Logf("Expected error for test URL: %v", err) } } func TestDownloadAndExtractWithProgress(t *testing.T) { logger.SetLogLevel(logger.LogLevelDebug) ctx := context.Background() // Example: with progress callback err := DownloadAndExtract( ctx, "https://example.com/archive.tar", "/tmp/test-extract", WithInsecureSkipVerify(), WithProgress(func(filename string, index int, total int) { t.Logf("Extracting: %s", filename) }), ) if err != nil { t.Logf("Expected error for test URL: %v", err) } }