协议代理枚举类型修复

This commit is contained in:
flswld
2023-01-23 17:22:05 +08:00
parent 0b3cfe06cb
commit 0ab4fd1d18

View File

@@ -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
}