From 0ab4fd1d186956d2ee2b471dc35afe604b0cbb10 Mon Sep 17 00:00:00 2001 From: flswld Date: Mon, 23 Jan 2023 17:22:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E4=BB=A3=E7=90=86=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E7=B1=BB=E5=9E=8B=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gate/client_proto/client_proto_gen_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gate/client_proto/client_proto_gen_test.go b/gate/client_proto/client_proto_gen_test.go index fd6b5181..7446a9d3 100644 --- a/gate/client_proto/client_proto_gen_test.go +++ b/gate/client_proto/client_proto_gen_test.go @@ -57,7 +57,7 @@ func TestClientProtoGen(t *testing.T) { if !strings.Contains(line, "enum") { continue } - split := strings.Split(line, " ") + split := strings.Split(strings.TrimSpace(line), " ") if len(split) != 3 || split[0] != "enum" || split[2] != "{" { continue } @@ -66,16 +66,16 @@ func TestClientProtoGen(t *testing.T) { if refEnum == nil { continue } + for _, ref := range refEnum { + newFileStr += ref + "\n" + } i++ - x := 0 for { nextLine := rawFileLine[i] - if !strings.Contains(nextLine, "}") && x < len(refEnum) { - newFileStr += refEnum[x] + "\n" + if !strings.Contains(nextLine, "}") { i++ - x++ } else { - newFileStr += line + "\n" + newFileStr += nextLine + "\n" break } } @@ -111,7 +111,7 @@ func FindEnumInDirFile(path string, name string) (lineList []string) { if !strings.Contains(line, "enum") { continue } - split := strings.Split(line, " ") + split := strings.Split(strings.TrimSpace(line), " ") if len(split) != 3 || split[0] != "enum" || split[2] != "{" { continue }