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

Function testGeneratedFileBasicStructure

internal/extgen/gofile_test.go:1240–1257  ·  view source on GitHub ↗
(t *testing.T, content, expectedPackage, baseName string)

Source from the content-addressed store, hash-verified

1238}
1239
1240func testGeneratedFileBasicStructure(t *testing.T, content, expectedPackage, baseName string) {
1241 requiredElements := []string{
1242 "package " + expectedPackage,
1243 "// #include <stdlib.h>",
1244 `// #include "` + baseName + `.h"`,
1245 `import "C"`,
1246 "func init() {",
1247 "frankenphp.RegisterExtension(",
1248 "}",
1249 }
1250
1251 for _, element := range requiredElements {
1252 assert.Contains(t, content, element, "Generated file should contain: %s", element)
1253 }
1254
1255 assert.NotContains(t, content, "func internalHelper", "Generated file should not contain internal functions from source")
1256 assert.NotContains(t, content, "func anotherHelper", "Generated file should not contain internal functions from source")
1257}
1258
1259func testGeneratedFileWrappers(t *testing.T, content string, functions []phpFunction) {
1260 for _, fn := range functions {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected