github.com/sandwich-go/boost@v1.3.29/misc/xgen/ugly_test.go (about) 1 package xgen 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 var testCode = []byte(` 9 /* 10 * I am C style comments 11 */ 12 // Code generated by ProtoKit. DO NOT EDIT. (client) 13 // from sheet@ErrorCode|Design 14 syntax = "proto3"; 15 package rawdata; 16 option go_package = "example/gen/golang/rawdata"; 17 option csharp_namespace = "gen.rawdata"; 18 // annotation@annotation_type(type="rawdata") 19 // annotation@rawdata(row="ErrorCode",table="ErrorCodeMap",table_wrapper="ErrorCodeConf",map="true",map_key_type="int32",data="ErrorCodeConf") 20 // annotation@ab(table_ab="ErrorCodeMapAB",table_ab_patch="ErrorCodeMapABPatch",table_ab_value="ErrorCodeMapABValue",ab_patch="false") 21 // annotation@filter(just_server="false",just_client="false") 22 // annotation@ErrorCode(id="id") 23 24 25 message ErrorCode{ 26 // 错误信息id 27 // annotation@field_id(id="true") 28 int32 id = 1; 29 // 错误信息key 30 string Key = 2; 31 } 32 message ErrorCodeMapABValue{ 33 map<int32, ErrorCode> ErrorCodeMap = 1; 34 } 35 message ErrorCodeConf{ 36 map<int32, ErrorCode> ErrorCodeMap = 1; 37 map<string, ErrorCodeMapABValue> ErrorCodeMapAB = 2; 38 map<string, ErrorCodeMapABValue> ErrorCodeMapABPatch = 3; 39 } 40 `) 41 42 func TestRmoveCAndCppCommentAndBlanklines(t *testing.T) { 43 fmt.Println(string(RmoveCAndCppCommentAndBlanklines(testCode))) 44 }