From 0eeb2deef06f02fa0afb06329663b31932ec7fee 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 13:42:46 +0800 Subject: [PATCH] test --- plugins/zltx/internal/zltx_test.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/plugins/zltx/internal/zltx_test.go b/plugins/zltx/internal/zltx_test.go index b4952b5..281bb19 100644 --- a/plugins/zltx/internal/zltx_test.go +++ b/plugins/zltx/internal/zltx_test.go @@ -31,19 +31,33 @@ func TestConfig(t *testing.T) { }) } +func StrIdx(str string, substr string) string { + substr = fmt.Sprintf("%s:", substr) // "order:" "result:" + index := strings.Index(str, substr) + if index == -1 { + return "" + } + return str[index+len(substr):] +} + func TestOrder(t *testing.T) { request := &proto.OrderRequest{ Config: config(), Order: &proto.OrderRequest_Order{ - OrderNo: "test_zltx_4", - Account: "18666666666", - Extra: nil, + OrderNo: "test_zltx_4", + Account: "18666666666", + Quantity: 1, + Extra: nil, }, Product: &proto.OrderRequest_Product{ ProductNo: "106", Extra: []byte(`{}`), }, } + fmt.Println(request.String()) + //fmt.Println(StrIdx(request.String(), "order")) + //fmt.Println(StrIdx(request.String(), "product")) + t.Run("TestOrder", func(t *testing.T) { got, err := zltx.Order(context.Background(), request) if err != nil {