🎨 大部分的 make 指令

This commit is contained in:
zhaoyupeng
2025-11-24 18:37:44 +08:00
commit 27fa38aef0
38 changed files with 4356 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
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)
}
}