Apply .gitignore rules

This commit is contained in:
皮蛋13361098506
2025-01-06 16:21:36 +08:00
parent 1b77f62820
commit ccd2c530cf
580 changed files with 69806 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
package fileUtil
import (
"fmt"
"testing"
)
func TestGzip(t *testing.T) {
path := GetCurrentPath()
fmt.Printf("CurrPath:%s\n", path)
fileName := fmt.Sprintf("%s/%s", path, "test.txt")
if err := WriteFile(path, "test.txt", true, "first line\nHello world"); err != nil {
t.Errorf("there should be no error, but now it is:%s", err)
}
if err := Gzip(fileName, ""); err != nil {
// if err := Gzip(fileName, path); err != nil {
t.Errorf("There should be no error, but now it has:%s", err)
}
if fileList, err := GetFileList(path); err != nil {
t.Errorf("There should be no error, but now it has:%s", err)
} else {
for _, item := range fileList {
fmt.Printf("item:%s\n", item)
}
}
DeleteFile(fileName)
}
func TestUnGzip(t *testing.T) {
path := GetCurrentPath()
fmt.Printf("CurrPath:%s\n", path)
fileName := fmt.Sprintf("%s/%s", path, "test.txt.gz")
if err := UnGzip(fileName, ""); err != nil {
// if err := UnGzip(fileName, path); err != nil {
t.Errorf("There should be no error, but now it has:%s", err)
}
content, err := ReadFileContent(fmt.Sprintf("%s/%s", path, "test.txt"))
if err != nil {
t.Errorf("There should be no error, but now it has:%s", err)
} else {
fmt.Printf("content:%s\n", content)
}
DeleteFile(fileName)
fileName = fmt.Sprintf("%s/%s", path, "test.txt")
DeleteFile(fileName)
}