(t *testing.T)
| 91 | } |
| 92 | |
| 93 | func TestHeaderGenerator_HeaderGuardGeneration(t *testing.T) { |
| 94 | tests := []struct { |
| 95 | baseName string |
| 96 | expectedGuard string |
| 97 | }{ |
| 98 | {"simple", "_SIMPLE_H"}, |
| 99 | {"my-extension", "_MY_EXTENSION_H"}, |
| 100 | {"complex.name", "_COMPLEX_NAME_H"}, |
| 101 | {"under_score", "_UNDER_SCORE_H"}, |
| 102 | {"MixedCase", "_MIXEDCASE_H"}, |
| 103 | {"123numeric", "_123NUMERIC_H"}, |
| 104 | {"special!@#chars", "_SPECIAL___CHARS_H"}, |
| 105 | } |
| 106 | |
| 107 | for _, tt := range tests { |
| 108 | t.Run(tt.baseName, func(t *testing.T) { |
| 109 | generator := &Generator{BaseName: tt.baseName} |
| 110 | headerGen := HeaderGenerator{generator} |
| 111 | content, err := headerGen.buildContent() |
| 112 | require.NoError(t, err) |
| 113 | |
| 114 | expectedIfndef := "#ifndef " + tt.expectedGuard |
| 115 | expectedDefine := "#define " + tt.expectedGuard |
| 116 | |
| 117 | assert.Contains(t, content, expectedIfndef, "Expected #ifndef %s, but not found in content", tt.expectedGuard) |
| 118 | assert.Contains(t, content, expectedDefine, "Expected #define %s, but not found in content", tt.expectedGuard) |
| 119 | }) |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | func TestHeaderGenerator_BasicStructure(t *testing.T) { |
| 124 | generator := &Generator{BaseName: "structtest"} |
nothing calls this directly
no test coverage detected