feat: tested

This commit is contained in:
2024-09-01 23:48:01 +08:00
parent eeca2decb2
commit 987e750d5e
3 changed files with 25 additions and 42 deletions

33
main.go
View File

@@ -10,38 +10,9 @@ import (
func main() {
key := []byte{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}
fmt.Println(hex.EncodeToString(key))
encFs := encfs.NewEncFs(key)
encFs2 := encfs.NewEncFs(nil)
// -----------------------------------------------------------------------------------------------------------------------------------
encFile1, err := encFs2.Create("test1")
if err != nil {
fmt.Println(err)
return
}
encFile1.Write([]byte("hello world"))
encFile1.Write([]byte("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"))
encFile1.WriteAt([]byte("TEST"), 10)
encFile1.Write([]byte("------"))
encFile1.Close()
encFile2, err := encFs2.Create("test2")
if err != nil {
fmt.Println(err)
return
}
encFile2.Write([]byte("hello world"))
seekI, err := encFile2.Seek(2, 0)
fmt.Println(seekI, ", ", err)
encFile2.Write([]byte("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"))
encFile2.Write([]byte("------"))
encFile2.Close()
// -----------------------------------------------------------------------------------------------------------------------------------
func() {
encFile, err := encFs.Create("test")
@@ -80,4 +51,6 @@ func main() {
fmt.Println(readLen, err)
fmt.Println(string(buff))
}()
encFs.Remove("test")
}