This commit is contained in:
李子铭 2024-10-28 11:39:10 +08:00
parent 21a69eda33
commit 007f2c462b
1 changed files with 13 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"gitea.cdlsxd.cn/sdk/plugin/proto" "gitea.cdlsxd.cn/sdk/plugin/proto"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"strings"
"testing" "testing"
) )
@ -70,7 +71,19 @@ func TestQuery(t *testing.T) {
t.Errorf("Query() error = %v", err) t.Errorf("Query() error = %v", err)
return return
} }
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:")
if index == -1 {
fmt.Println("result: not found in the string")
return
}
// 截取 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))
}) })
} }