From 007f2c462b50c302cec5aa38ccd220f87a5caab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AD=90=E9=93=AD?= Date: Mon, 28 Oct 2024 11:39:10 +0800 Subject: [PATCH] test --- plugins/zltx/internal/zltx_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/zltx/internal/zltx_test.go b/plugins/zltx/internal/zltx_test.go index 1ba3126..e760730 100644 --- a/plugins/zltx/internal/zltx_test.go +++ b/plugins/zltx/internal/zltx_test.go @@ -6,6 +6,7 @@ import ( "fmt" "gitea.cdlsxd.cn/sdk/plugin/proto" "github.com/stretchr/testify/assert" + "strings" "testing" ) @@ -70,7 +71,19 @@ func TestQuery(t *testing.T) { t.Errorf("Query() error = %v", err) return } + result := got.String() 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)) }) }