@@ -34,7 +34,7 @@ func TestGeneratedEnumsExist(t *testing.T) {
3434 for _ , tc := range testCases {
3535 t .Run (tc .dir + "/" + tc .expectedFile , func (t * testing.T ) {
3636 filePath := filepath .Join (tc .dir , tc .expectedFile )
37-
37+
3838 // Check file exists
3939 if _ , err := os .Stat (filePath ); os .IsNotExist (err ) {
4040 t .Errorf ("Expected generated file %s does not exist" , filePath )
@@ -66,21 +66,21 @@ func TestGeneratedEnumsExist(t *testing.T) {
6666// validateEnumFileStructure checks that the generated file has the expected enum components
6767func validateEnumFileStructure (t * testing.T , content , filePath string ) error {
6868 requiredPatterns := []string {
69- "// DO NOT EDIT." , // Generated file header
70- "code generated by goenums" , // Generator attribution
71- "type .* struct {" , // Enum wrapper type
72- "Container struct {" , // Container type
73- "func Parse.*\\ (input any\\ )" , // Parse function
74- "func .*\\ .String\\ (\\ ) string" , // String method
75- "func .*\\ .IsValid\\ (\\ ) bool" , // IsValid method
76- "func .*\\ .MarshalJSON\\ (\\ )" , // JSON marshaling
77- "func .*\\ .UnmarshalJSON\\ (" , // JSON unmarshaling
78- "func .*\\ .MarshalText\\ (\\ )" , // Text marshaling
79- "func .*\\ .UnmarshalText\\ (" , // Text unmarshaling
80- "func .*\\ .MarshalBinary\\ (\\ )" , // Binary marshaling
81- "func .*\\ .UnmarshalBinary\\ (" , // Binary unmarshaling
82- "func .*\\ .Scan\\ (" , // SQL Scanner
83- "func .*\\ .Value\\ (\\ )" , // SQL Valuer
69+ "// DO NOT EDIT." , // Generated file header
70+ "code generated by goenums" , // Generator attribution
71+ "type .* struct {" , // Enum wrapper type
72+ "Container struct {" , // Container type
73+ "func Parse.*\\ (input any\\ )" , // Parse function
74+ "func .*\\ .String\\ (\\ ) string" , // String method
75+ "func .*\\ .IsValid\\ (\\ ) bool" , // IsValid method
76+ "func .*\\ .MarshalJSON\\ (\\ )" , // JSON marshaling
77+ "func .*\\ .UnmarshalJSON\\ (" , // JSON unmarshaling
78+ "func .*\\ .MarshalText\\ (\\ )" , // Text marshaling
79+ "func .*\\ .UnmarshalText\\ (" , // Text unmarshaling
80+ "func .*\\ .MarshalBinary\\ (\\ )" , // Binary marshaling
81+ "func .*\\ .UnmarshalBinary\\ (" , // Binary unmarshaling
82+ "func .*\\ .Scan\\ (" , // SQL Scanner
83+ "func .*\\ .Value\\ (\\ )" , // SQL Valuer
8484 }
8585
8686 for _ , pattern := range requiredPatterns {
@@ -90,7 +90,7 @@ func validateEnumFileStructure(t *testing.T, content, filePath string) error {
9090 simplePattern = strings .ReplaceAll (simplePattern , "\\ (" , "(" )
9191 simplePattern = strings .ReplaceAll (simplePattern , "\\ )" , ")" )
9292 simplePattern = strings .ReplaceAll (simplePattern , "\\ \\ " , "" )
93-
93+
9494 if ! strings .Contains (content , simplePattern ) {
9595 t .Logf ("Missing pattern in %s: %s" , filePath , pattern )
9696 }
@@ -104,7 +104,7 @@ func validateEnumFileStructure(t *testing.T, content, filePath string) error {
104104func TestGeneratedEnumsAreValidJSONMarshalable (t * testing.T ) {
105105 // This is a compile-time test - if any enum doesn't implement json.Marshaler properly,
106106 // the compilation will fail when we try to marshal it
107-
107+
108108 testData := []interface {}{
109109 map [string ]interface {}{"test" : "value" },
110110 }
@@ -152,7 +152,7 @@ func TestParsePointerFix(t *testing.T) {
152152 found = true
153153 break
154154 }
155-
155+
156156 // Also check for the new number type format
157157 if tc .content == "func numberToAlgorithm[T constraints.Integer | constraints.Float](num T) *Algorithm" {
158158 // Check for the new format
@@ -170,7 +170,7 @@ func TestParsePointerFix(t *testing.T) {
170170 }
171171}
172172
173- // TestValidityMapFix tests that the validity map fix works correctly
173+ // TestValidityMapFix tests that the validity map fix works correctly
174174func TestValidityMapFix (t * testing.T ) {
175175 // Test that invalid package correctly marks only FAILED as invalid
176176 content , err := os .ReadFile ("invalid/statuses_enums.go" )
@@ -180,7 +180,7 @@ func TestValidityMapFix(t *testing.T) {
180180
181181 contentStr := string (content )
182182
183- // Should have FAILED: false (invalid)
183+ // Should have FAILED: false (invalid)
184184 if ! strings .Contains (contentStr , "Statuses.FAILED" ) || ! strings .Contains (contentStr , "false" ) {
185185 t .Error ("FAILED should be marked as invalid (false) in validity map" )
186186 }
@@ -211,12 +211,12 @@ func TestNegativePackageCompiles(t *testing.T) {
211211
212212 // Check validity markers: NONE should be invalid, others should be valid
213213 contentStr := string (content )
214-
214+
215215 // NONE should be invalid due to "// invalid" comment
216216 if ! strings .Contains (contentStr , "Algorithms.NONE:" ) || ! strings .Contains (contentStr , "false," ) {
217217 t .Errorf ("NONE should be marked as invalid (false) in validity map" )
218218 }
219-
219+
220220 // AES256 and CHACHA20 should be valid
221221 validEnums := []string {"AES256" , "CHACHA20" }
222222 for _ , enum := range validEnums {
@@ -229,7 +229,7 @@ func TestNegativePackageCompiles(t *testing.T) {
229229// TestMultiplePackageCompiles tests that the multiple package compiles correctly
230230func TestMultiplePackageCompiles (t * testing.T ) {
231231 files := []string {"multiple/statuses_enums.go" , "multiple/orders_enums.go" }
232-
232+
233233 for _ , file := range files {
234234 t .Run (file , func (t * testing.T ) {
235235 content , err := os .ReadFile (file )
@@ -260,4 +260,4 @@ func TestTimePackageFloatIssue(t *testing.T) {
260260 if err != nil {
261261 t .Errorf ("time/sales_enums.go should compile without errors: %v" , err )
262262 }
263- }
263+ }
0 commit comments