You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.7 KiB
68 lines
1.7 KiB
package operaSystem
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestFile_ByteToBase64(t *testing.T) {
|
|
byteStr := []byte("hello world!")
|
|
base64Str := operaSystem.ByteToBase64(byteStr)
|
|
byteResult, _ := operaSystem.Base64ToByte(base64Str)
|
|
fmt.Println(base64Str)
|
|
fmt.Println(byteResult)
|
|
}
|
|
|
|
func TestOperaSystem_FileName(t *testing.T) {
|
|
filePath := "./file.go"
|
|
fileName := operaSystem.FileName(filePath)
|
|
fmt.Println(fileName)
|
|
}
|
|
func TestOperaSystem_FileSize(t *testing.T) {
|
|
filePath := "./file.go"
|
|
fileSize := operaSystem.FileSize(filePath)
|
|
fmt.Println(fileSize)
|
|
}
|
|
func TestOperaSystem_FileModTime(t *testing.T) {
|
|
filePath := "./file1.go"
|
|
fileModTime := operaSystem.FileModTime(filePath)
|
|
fmt.Println(fileModTime)
|
|
}
|
|
func TestOperaSystem_FileMode(t *testing.T) {
|
|
filePath := "./file.go"
|
|
fileMode := operaSystem.FileMode(filePath)
|
|
fmt.Println(fileMode)
|
|
}
|
|
|
|
func TestOperaSystem_IsDir(t *testing.T) {
|
|
filePath := "./"
|
|
isDir := operaSystem.IsDir(filePath)
|
|
fmt.Println(isDir)
|
|
}
|
|
|
|
// Exist 判断文件是否存在
|
|
func TestOperaSystem_FileExist(t *testing.T) {
|
|
filePath := "./file.go"
|
|
isExist := operaSystem.FileExist(filePath)
|
|
fmt.Println(isExist)
|
|
}
|
|
func TestOperaSystem_RemovePrefix(t *testing.T) {
|
|
filePath := "./file.go"
|
|
filePath = operaSystem.RemovePrefix(filePath)
|
|
fmt.Println(filePath)
|
|
}
|
|
func TestOperaSystem_RemoveSuffix(t *testing.T) {
|
|
filePath := "./file.go"
|
|
filePath = operaSystem.RemoveSuffix(filePath)
|
|
fmt.Println(filePath)
|
|
}
|
|
|
|
func TestOperaSystem_FileAppendString(t *testing.T) {
|
|
filePath := "./file_test.go"
|
|
operaSystem.FileAppendString("//将String写入文件 追加模式\n", filePath)
|
|
fmt.Println(filePath)
|
|
}
|
|
|
|
//将String写入文件 追加模式
|
|
//将String写入文件 追加模式
|