(t *testing.T, content, expectedPackage, baseName string)
| 1238 | } |
| 1239 | |
| 1240 | func 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 | |
| 1259 | func testGeneratedFileWrappers(t *testing.T, content string, functions []phpFunction) { |
| 1260 | for _, fn := range functions { |
no outgoing calls
no test coverage detected