(t *testing.T, content, baseName string)
| 274 | } |
| 275 | |
| 276 | func testHeaderBasicStructure(t *testing.T, content, baseName string) { |
| 277 | headerGuard := strings.Map(func(r rune) rune { |
| 278 | if r >= 'A' && r <= 'Z' || r >= 'a' && r <= 'z' || r >= '0' && r <= '9' { |
| 279 | return r |
| 280 | } |
| 281 | |
| 282 | return '_' |
| 283 | }, baseName) |
| 284 | headerGuard = strings.ToUpper(headerGuard) + "_H" |
| 285 | |
| 286 | requiredElements := []string{ |
| 287 | "#ifndef _" + headerGuard, |
| 288 | "#define _" + headerGuard, |
| 289 | "#include <php.h>", |
| 290 | "extern zend_module_entry test_extension_module_entry;", |
| 291 | "#endif", |
| 292 | } |
| 293 | |
| 294 | for _, element := range requiredElements { |
| 295 | assert.Contains(t, content, element, "Header file should contain: %s", element) |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | func testHeaderIncludeGuards(t *testing.T, content, expectedGuard string) { |
| 300 | expectedIfndef := "#ifndef _" + expectedGuard |
no outgoing calls
no test coverage detected