Skip to content

Commit

Permalink
更新测试用例
Browse files Browse the repository at this point in the history
  • Loading branch information
zenkilan committed Sep 28, 2021
1 parent 71f25a4 commit 7665060
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions pkg/ipa/analyse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,39 @@ import (
)

func TestGetBuildNumberFromIPA(t *testing.T) {
ipaLocalPath := "./test.ipa"
buildNumber, err := GetBuildNumberFromIPA(ipaLocalPath)
assert.Nil(t, err)
t.Logf("build number is->%s", buildNumber)
// 定义测试用例参数
type args struct {
ipaLocalPath string
}
// 定义测试用例预期结果
type want struct {
buildNumber string
}
// 定义并初始化测试用例
tests := []struct {
name string
args args
want want
}{
{
name: "Get the CFBundleVersion from Info.plist successfully",
args: args{
ipaLocalPath: "./test.ipa",
},
want: want{
buildNumber: "3412",
},
},
}
// 遍历用例
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// 执行待测方法
buildNumber, err := GetBuildNumberFromIPA(tt.args.ipaLocalPath)
t.Logf("build number is->%s", buildNumber)
// 断言
assert.Nil(t, err)
assert.Equal(t, tt.want.buildNumber, buildNumber)
})
}
}

0 comments on commit 7665060

Please sign in to comment.