test
This commit is contained in:
parent
21a69eda33
commit
007f2c462b
|
@ -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))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue