(t *testing.T)
| 137 | } |
| 138 | |
| 139 | func TestHeaderGenerator_CompleteStructure(t *testing.T) { |
| 140 | generator := &Generator{BaseName: "complete_test"} |
| 141 | headerGen := HeaderGenerator{generator} |
| 142 | content, err := headerGen.buildContent() |
| 143 | require.NoError(t, err) |
| 144 | |
| 145 | lines := strings.Split(content, "\n") |
| 146 | |
| 147 | assert.GreaterOrEqual(t, len(lines), 5, "Header file should have multiple lines") |
| 148 | |
| 149 | var foundIfndef, foundDefine, foundEndif bool |
| 150 | |
| 151 | for _, line := range lines { |
| 152 | line = strings.TrimSpace(line) |
| 153 | if line == "" { |
| 154 | continue |
| 155 | } |
| 156 | |
| 157 | if strings.HasPrefix(line, "#ifndef") && !foundIfndef { |
| 158 | foundIfndef = true |
| 159 | } else if strings.HasPrefix(line, "#define") && foundIfndef && !foundDefine { |
| 160 | foundDefine = true |
| 161 | } else if line == "#endif" { |
| 162 | foundEndif = true |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | assert.True(t, foundIfndef, "Header should start with #ifndef guard") |
| 167 | assert.True(t, foundDefine, "Header should have #define after #ifndef") |
| 168 | assert.True(t, foundEndif, "Header should end with #endif") |
| 169 | } |
| 170 | |
| 171 | func TestHeaderGenerator_ErrorHandling(t *testing.T) { |
| 172 | generator := &Generator{ |
nothing calls this directly
no test coverage detected