MCPcopy Create free account
hub / github.com/php/frankenphp / testHeaderIncludeGuards

Function testHeaderIncludeGuards

internal/extgen/hfile_test.go:299–315  ·  view source on GitHub ↗
(t *testing.T, content, expectedGuard string)

Source from the content-addressed store, hash-verified

297}
298
299func testHeaderIncludeGuards(t *testing.T, content, expectedGuard string) {
300 expectedIfndef := "#ifndef _" + expectedGuard
301 expectedDefine := "#define _" + expectedGuard
302
303 assert.Contains(t, content, expectedIfndef, "Header should contain: %s", expectedIfndef)
304 assert.Contains(t, content, expectedDefine, "Header should contain: %s", expectedDefine)
305 assert.Contains(t, content, "#endif", "Header should end with #endif")
306
307 ifndefPos := strings.Index(content, expectedIfndef)
308 definePos := strings.Index(content, expectedDefine)
309
310 assert.Less(t, ifndefPos, definePos, "#ifndef should come before #define")
311
312 endifPos := strings.LastIndex(content, "#endif")
313 assert.NotEqual(t, -1, endifPos, "Header should end with #endif")
314 assert.Greater(t, endifPos, definePos, "#endif should come after #define")
315}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected