@@ -113,11 +113,22 @@ func TestFormat(t *testing.T) {
113113 },
114114 expected : "Example is: {123 This is a test str, nothing more special -1.098743 main question error, is 42}" ,
115115 },
116- "open bracket at the end of line of go file " : {
116+ "open bracket at the end of line of go line " : {
117117 template : "type serviceHealth struct {" ,
118118 args : []any {},
119119 expected : "type serviceHealth struct {" ,
120120 },
121+ "open bracket at the end of line of go line with {} inside" : {
122+ template : "func afterHandle(respWriter *http.ResponseWriter, statusCode int, data interface{}) {" ,
123+ args : []any {},
124+ expected : "func afterHandle(respWriter *http.ResponseWriter, statusCode int, data interface{}) {" ,
125+ },
126+
127+ "close bracket at the end of line of go line with {} inside" : {
128+ template : "func afterHandle(respWriter *http.ResponseWriter, statusCode int, data interface{}) }" ,
129+ args : []any {},
130+ expected : "func afterHandle(respWriter *http.ResponseWriter, statusCode int, data interface{}) }" ,
131+ },
121132 } {
122133 t .Run (name , func (t * testing.T ) {
123134 assert .Equal (t , test .expected , stringFormatter .Format (test .template , test .args ... ))
@@ -202,6 +213,17 @@ func TestFormatComplex(t *testing.T) {
202213 args : map [string ]any {},
203214 expected : " \" server\" : {" ,
204215 },
216+ "open bracket at the end of line of go line with {} inside" : {
217+ template : "func afterHandle(respWriter *http.ResponseWriter, statusCode int, data interface{}) {" ,
218+ args : map [string ]any {},
219+ expected : "func afterHandle(respWriter *http.ResponseWriter, statusCode int, data interface{}) {" ,
220+ },
221+
222+ "close bracket at the end of line of go line with {} inside" : {
223+ template : "func afterHandle(respWriter *http.ResponseWriter, statusCode int, data interface{}) }" ,
224+ args : map [string ]any {},
225+ expected : "func afterHandle(respWriter *http.ResponseWriter, statusCode int, data interface{}) }" ,
226+ },
205227 } {
206228 t .Run (name , func (t * testing.T ) {
207229 assert .Equal (t , test .expected , stringFormatter .FormatComplex (test .template , test .args ))
0 commit comments