parent
2f462a4693
commit
bdb5d5944a
|
@ -187,14 +187,22 @@ extension Templates {
|
||||||
],
|
],
|
||||||
terminal
|
terminal
|
||||||
)
|
)
|
||||||
try fileSystem.writeFileContents(project.path.appending(
|
|
||||||
|
try fileSystem.removeFileTree(project.path.appending(
|
||||||
components: "Sources",
|
components: "Sources",
|
||||||
project.name,
|
project.name,
|
||||||
"main.swift"
|
"main.swift"
|
||||||
|
))
|
||||||
|
|
||||||
|
try fileSystem.writeFileContents(project.path.appending(
|
||||||
|
components: "Sources",
|
||||||
|
project.name,
|
||||||
|
"App.swift"
|
||||||
)) {
|
)) {
|
||||||
"""
|
"""
|
||||||
import TokamakDOM
|
import TokamakDOM
|
||||||
|
|
||||||
|
@main
|
||||||
struct TokamakApp: App {
|
struct TokamakApp: App {
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup("Tokamak App") {
|
WindowGroup("Tokamak App") {
|
||||||
|
@ -208,11 +216,6 @@ extension Templates {
|
||||||
Text("Hello, world!")
|
Text("Hello, world!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @main attribute is not supported in SwiftPM apps.
|
|
||||||
// See https://bugs.swift.org/browse/SR-12683 for more details.
|
|
||||||
TokamakApp.main()
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
.write(to: $0)
|
.write(to: $0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,8 @@ final class InitCommandTests: XCTestCase {
|
||||||
"Sources/\(package) does not exist"
|
"Sources/\(package) does not exist"
|
||||||
)
|
)
|
||||||
XCTAssertTrue(
|
XCTAssertTrue(
|
||||||
packageDirectory.ls().contains("Sources/\(package)/main.swift"),
|
packageDirectory.ls().contains("Sources/\(package)/App.swift"),
|
||||||
"Sources/\(package)/main.swift does not exist"
|
"Sources/\(package)/App.swift does not exist"
|
||||||
)
|
)
|
||||||
XCTAssertTrue(packageDirectory.ls().contains("Tests"), "Tests does not exist")
|
XCTAssertTrue(packageDirectory.ls().contains("Tests"), "Tests does not exist")
|
||||||
XCTAssertTrue(
|
XCTAssertTrue(
|
||||||
|
@ -88,7 +88,7 @@ final class InitCommandTests: XCTestCase {
|
||||||
)
|
)
|
||||||
|
|
||||||
let actualTemplateSource = try String(contentsOfFile: packageDirectory
|
let actualTemplateSource = try String(contentsOfFile: packageDirectory
|
||||||
.appending(components: "Sources", package, "main.swift").pathString)
|
.appending(components: "Sources", package, "App.swift").pathString)
|
||||||
|
|
||||||
XCTAssertEqual(expectedTemplateSource, actualTemplateSource, "Template Sources do not match")
|
XCTAssertEqual(expectedTemplateSource, actualTemplateSource, "Template Sources do not match")
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,7 @@ final class InitCommandTests: XCTestCase {
|
||||||
"""
|
"""
|
||||||
import TokamakDOM
|
import TokamakDOM
|
||||||
|
|
||||||
|
@main
|
||||||
struct TokamakApp: App {
|
struct TokamakApp: App {
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup("Tokamak App") {
|
WindowGroup("Tokamak App") {
|
||||||
|
@ -111,10 +112,5 @@ final class InitCommandTests: XCTestCase {
|
||||||
Text("Hello, world!")
|
Text("Hello, world!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @main attribute is not supported in SwiftPM apps.
|
|
||||||
// See https://bugs.swift.org/browse/SR-12683 for more details.
|
|
||||||
TokamakApp.main()
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue