2020-12-28 10:23:54 +08:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2021-03-07 21:02:56 +08:00
|
|
|
"path/filepath"
|
2020-12-28 10:23:54 +08:00
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSplit(t *testing.T) {
|
2021-03-05 21:25:44 +08:00
|
|
|
drive_id := "/123/456"
|
|
|
|
strs := strings.Split(drive_id, "/")
|
2020-12-28 10:23:54 +08:00
|
|
|
fmt.Println(strs)
|
2021-03-05 21:25:44 +08:00
|
|
|
}
|
2021-03-06 23:19:16 +08:00
|
|
|
|
|
|
|
func TestPassword(t *testing.T) {
|
|
|
|
fullName:="hello.password-xhf"
|
|
|
|
index:=strings.Index(fullName,".password-")
|
|
|
|
name:=fullName[:index]
|
|
|
|
password:=fullName[index+10:]
|
|
|
|
fmt.Printf("name:%s, password:%s\n",name,password)
|
2021-03-07 21:02:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDir(t *testing.T) {
|
|
|
|
dir,file:=filepath.Split("/root/")
|
|
|
|
fmt.Printf("dir:%s\nfile:%s\n",dir,file)
|
2021-03-06 23:19:16 +08:00
|
|
|
}
|