@@ -134,7 +134,7 @@ const FalseConstant = false`,
134134 tmpFile := filepath .Join (tmpDir , tt .name + ".go" )
135135 require .NoError (t , os .WriteFile (tmpFile , []byte (tt .input ), 0644 ))
136136
137- parser := NewConstantParserWithDefRegex ()
137+ parser := & ConstantParser {}
138138 constants , err := parser .parse (tmpFile )
139139 assert .NoError (t , err , "parse() error" )
140140
@@ -200,7 +200,7 @@ const InvalidSyntax`,
200200 tmpFile := filepath .Join (tmpDir , tt .name + ".go" )
201201 require .NoError (t , os .WriteFile (tmpFile , []byte (tt .input ), 0644 ))
202202
203- parser := NewConstantParserWithDefRegex ()
203+ parser := & ConstantParser {}
204204 _ , err := parser .parse (tmpFile )
205205 require .NotNil (t , err )
206206
@@ -231,7 +231,7 @@ const ThirdIota = iota`
231231 fileName := filepath .Join (tmpDir , "test.go" )
232232 require .NoError (t , os .WriteFile (fileName , []byte (input ), 0644 ))
233233
234- parser := NewConstantParserWithDefRegex ()
234+ parser := & ConstantParser {}
235235 constants , err := parser .parse (fileName )
236236 assert .NoError (t , err , "parse() error" )
237237
@@ -343,7 +343,7 @@ const INVALID = "missing class name"`,
343343 tmpFile := filepath .Join (tmpDir , tt .name + ".go" )
344344 require .NoError (t , os .WriteFile (tmpFile , []byte (tt .input ), 0644 ))
345345
346- parser := NewConstantParserWithDefRegex ()
346+ parser := & ConstantParser {}
347347 constants , err := parser .parse (tmpFile )
348348 assert .NoError (t , err , "parse() error" )
349349
@@ -379,8 +379,6 @@ const INVALID = "missing class name"`,
379379}
380380
381381func TestConstantParserRegexMatch (t * testing.T ) {
382- parser := NewConstantParserWithDefRegex ()
383-
384382 testCases := []struct {
385383 line string
386384 expected bool
@@ -397,15 +395,13 @@ func TestConstantParserRegexMatch(t *testing.T) {
397395
398396 for _ , tc := range testCases {
399397 t .Run (tc .line , func (t * testing.T ) {
400- matches := parser . constRegex .MatchString (tc .line )
398+ matches := constRegex .MatchString (tc .line )
401399 assert .Equal (t , tc .expected , matches , "Expected regex match for line '%s'" , tc .line )
402400 })
403401 }
404402}
405403
406404func TestConstantParserClassConstRegex (t * testing.T ) {
407- parser := NewConstantParserWithDefRegex ()
408-
409405 testCases := []struct {
410406 line string
411407 shouldMatch bool
@@ -425,7 +421,7 @@ func TestConstantParserClassConstRegex(t *testing.T) {
425421
426422 for _ , tc := range testCases {
427423 t .Run (tc .line , func (t * testing.T ) {
428- matches := parser . classConstRegex .FindStringSubmatch (tc .line )
424+ matches := classConstRegex .FindStringSubmatch (tc .line )
429425
430426 if tc .shouldMatch {
431427 assert .Len (t , matches , 2 , "Expected 2 matches for line '%s'" , tc .line )
@@ -441,8 +437,6 @@ func TestConstantParserClassConstRegex(t *testing.T) {
441437}
442438
443439func TestConstantParserDeclRegex (t * testing.T ) {
444- parser := NewConstantParserWithDefRegex ()
445-
446440 testCases := []struct {
447441 line string
448442 shouldMatch bool
@@ -462,7 +456,7 @@ func TestConstantParserDeclRegex(t *testing.T) {
462456
463457 for _ , tc := range testCases {
464458 t .Run (tc .line , func (t * testing.T ) {
465- matches := parser . constDeclRegex .FindStringSubmatch (tc .line )
459+ matches := constDeclRegex .FindStringSubmatch (tc .line )
466460
467461 if tc .shouldMatch {
468462 assert .Len (t , matches , 3 , "Expected 3 matches for line '%s'" , tc .line )
0 commit comments