Refactor CodeGen.swift into CodeGen+Signal.swift and CodeGen+Scaffolding.swift
This commit is contained in:
parent
84a536d314
commit
27edea19af
5 changed files with 361 additions and 295 deletions
|
|
@ -371,20 +371,20 @@ func testRecordInGenerateFiles() throws {
|
|||
#expect(output.contains("public let alpha: Double"))
|
||||
}
|
||||
|
||||
@Test("Constant and alias in single-file generate")
|
||||
func testConstantAndAliasInGenerate() throws {
|
||||
let repo = Repository(namespaces: [
|
||||
Namespace(name: "GLib", version: "2.0", constants: [
|
||||
Constant(name: "VERSION", value: "\"2.0\"", type: .string),
|
||||
], aliases: [
|
||||
Alias(name: "Type", cType: "GType", target: .uint64),
|
||||
@Test("Constant and alias in single-file generate")
|
||||
func testConstantAndAliasInGenerate() throws {
|
||||
let repo = Repository(namespaces: [
|
||||
Namespace(name: "GLib", version: "2.0", constants: [
|
||||
Constant(name: "VERSION", value: "2.0", type: .string),
|
||||
], aliases: [
|
||||
Alias(name: "Type", cType: "GType", target: .uint64),
|
||||
])
|
||||
])
|
||||
])
|
||||
let config = GenerationConfig(library: "GLib", version: "2.0", girsDirectories: [],
|
||||
targetDirectory: "", externalLibraries: [],
|
||||
generate: [], manual: [], ignore: [], objects: [])
|
||||
let generator = CodeGenerator(config: config)
|
||||
let output = try generator.generate(repository: repo, analysis: Analyzer(config: config).analyze(repository: repo))
|
||||
#expect(output.contains("public let version: String = \"2.0\""))
|
||||
#expect(output.contains("public typealias Type = UInt64"))
|
||||
}
|
||||
let config = GenerationConfig(library: "GLib", version: "2.0", girsDirectories: [],
|
||||
targetDirectory: "", externalLibraries: [],
|
||||
generate: [], manual: [], ignore: [], objects: [])
|
||||
let generator = CodeGenerator(config: config)
|
||||
let output = try generator.generate(repository: repo, analysis: Analyzer(config: config).analyze(repository: repo))
|
||||
#expect(output.contains("public let version: String = \"2.0\""))
|
||||
#expect(output.contains("public typealias Type = UInt64"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue