Skip to content

Commit

Permalink
fix: 修复 get_test.go 单元检测下 win 环境的文件路径错误
Browse files Browse the repository at this point in the history
  • Loading branch information
arrebole committed Apr 7, 2023
1 parent 6387d29 commit 5f98293
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ func GetStartBetweenEndFiles(t *testing.T, src, dst, correct, start, end string)
src = AbsPath(src)

if start != "" && start[0] != '/' {
start = filepath.Join(src, start)
start = path.Join(src, start)
}
if end != "" && end[0] != '/' {
end = filepath.Join(src, end)
end = path.Join(src, end)
}
if dst == "" {
_, err = Upx("get", src, "--start="+start, "--end="+end)
Expand All @@ -32,16 +32,17 @@ func GetStartBetweenEndFiles(t *testing.T, src, dst, correct, start, end string)
/*
测试目录 test1:start=123 end=999 test2:start=111 end=666
input: local: local:
|-- 111 ├── 333 ├── 111
|-- 333 ├── 666 ├── 333
|-- 777 │ ├── 111 └── 444
|-- 444 │ ├── 333 └── 666
! `-- 666 │ ├── 666
`-- 666 │ └── 777
|-- 111 └── 777
|-- 333
|-- 666
`-- 777
|-- 111 ├── 333 ├── 111
|-- 333 ├── 666 ├── 333
|-- 777 │ ├── 111 └── 444
|-- 444 │ ├── 333 └── 666
! `-- 666 │ ├── 666
`-- 666 │ └── 777
|-- 111 └── 777
|-- 333
|-- 666
`-- 777
*/
func TestGetStartBetweenEndFiles(t *testing.T) {
nowpath, _ := os.Getwd()
Expand Down Expand Up @@ -76,7 +77,7 @@ func TestGetStartBetweenEndFiles(t *testing.T) {
}
//构造测试目录
files := uploadFiles{
{name: "111", file: filepath.Join(localBase, "111"), dst: "", correct: filepath.Join(base, "111")},
{name: "111", file: filepath.Join(localBase, "111"), dst: "", correct: path.Join(base, "111")},
{name: "333", file: filepath.Join(localBase, "333"), dst: "", correct: path.Join(base, "333")},
{name: "333", file: "333", dst: path.Join(base, "333"), correct: path.Join(base, "333")},
{name: "777", file: "777", dst: base, correct: path.Join(base, "777")},
Expand Down Expand Up @@ -131,7 +132,7 @@ func TestGetStartBetweenEndFiles(t *testing.T) {
}
}

//递归获取下载到本地的文件
// 递归获取下载到本地的文件
func localFile(local, up string) []string {
var locals []string
localLen := len(local)
Expand All @@ -147,7 +148,7 @@ func localFile(local, up string) []string {
return locals
}

//递归获取云存储目录文件
// 递归获取云存储目录文件
func upFile(t *testing.T, up, start, end string) []string {
b, err := Upx("ls", up)
Nil(t, err)
Expand Down

0 comments on commit 5f98293

Please sign in to comment.