This commit is contained in:
李子铭 2024-10-28 11:41:56 +08:00
parent 46c6f2423b
commit ec8e8e4bb6
1 changed files with 3 additions and 8 deletions

View File

@ -71,8 +71,7 @@ func TestQuery(t *testing.T) {
fmt.Println("order: not found in the string") fmt.Println("order: not found in the string")
return return
} }
trimmedResult := requestString[index+len("order:"):] fmt.Println(requestString[index+len("order:"):])
fmt.Println(trimmedResult)
t.Run("TestQuery", func(t *testing.T) { t.Run("TestQuery", func(t *testing.T) {
got, err := zltx.Query(context.Background(), request) got, err := zltx.Query(context.Background(), request)
@ -82,16 +81,12 @@ func TestQuery(t *testing.T) {
} }
result := got.String() result := got.String()
fmt.Printf("%+v \n", got) fmt.Printf("%+v \n", got)
fmt.Printf("%s \n", got.Result.String()) index = strings.Index(result, "result:")
index := strings.Index(result, "result:")
if index == -1 { if index == -1 {
fmt.Println("result: not found in the string") fmt.Println("result: not found in the string")
return return
} }
// 截取 result: 后面的部分 fmt.Println(result[index+len("result:"):])
trimmedResult := result[index+len("result:"):]
fmt.Println(trimmedResult)
assert.Equal(t, int(proto.Status_SUCCESS), int(got.Result.Status)) assert.Equal(t, int(proto.Status_SUCCESS), int(got.Result.Status))
}) })