Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ import NodesGenerator
@main
internal struct NodesCodeGeneratorCommand: ParsableCommand {

#if swift(>=5.10)
nonisolated(unsafe) internal static let configuration: CommandConfiguration = .init(
commandName: "nodes-code-gen",
abstract: "Nodes Code Generator"
)
#else
internal static let configuration: CommandConfiguration = .init(
commandName: "nodes-code-gen",
abstract: "Nodes Code Generator"
)
#endif

@Option(help: "The name of the preset. (App|Scene|Window|Root)")
private var preset: Preset
Expand All @@ -48,4 +41,4 @@ internal struct NodesCodeGeneratorCommand: ParsableCommand {
}
}

extension Preset: ExpressibleByArgument {}
extension Preset: @retroactive ExpressibleByArgument {}
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@ import NodesGenerator
@main
internal struct NodesXcodeTemplatesGeneratorCommand: ParsableCommand {

#if swift(>=5.10)
nonisolated(unsafe) internal static let configuration: CommandConfiguration = .init(
commandName: "nodes-xcode-templates-gen",
abstract: "Nodes Xcode Templates Generator"
)
#else
internal static let configuration: CommandConfiguration = .init(
commandName: "nodes-xcode-templates-gen",
abstract: "Nodes Xcode Templates Generator"
)
#endif

@Option(name: .customLong("id"), help: "The Xcode templates identifier.")
private var identifier: String
Expand Down
2 changes: 1 addition & 1 deletion Sources/NodesGenerator/YAMLDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ import Codextended
import Yams

// Enables Codextended with YAMLDecoder [https://github.com/JohnSundell/Codextended]
extension YAMLDecoder: AnyDecoder {}
extension YAMLDecoder: @retroactive AnyDecoder {}
22 changes: 12 additions & 10 deletions Tests/NodesTestingTests/XCTestCaseTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ final class XCTestCaseTests: XCTestCase {
private static let parentPath: String = "^->BootstrapComponent->ParentComponent"
private static let childPath: String = "^->BootstrapComponent->ParentComponent->ChildComponent"

@MainActor
override func setUp() {
super.setUp()
expect(Self.registry.dependencyProviderFactory(for: Self.parentPath)) == nil
expect(Self.registry.dependencyProviderFactory(for: Self.childPath)) == nil
override func setUp() async throws {
try await super.setUp()
_ = await Task { @MainActor in
expect(Self.registry.dependencyProviderFactory(for: Self.parentPath)) == nil
expect(Self.registry.dependencyProviderFactory(for: Self.childPath)) == nil
}.result
}

@MainActor
override func tearDown() {
expect(Self.registry.dependencyProviderFactory(for: Self.parentPath)) == nil
expect(Self.registry.dependencyProviderFactory(for: Self.childPath)) == nil
super.tearDown()
override func tearDown() async throws {
_ = await Task { @MainActor in
expect(Self.registry.dependencyProviderFactory(for: Self.parentPath)) == nil
expect(Self.registry.dependencyProviderFactory(for: Self.childPath)) == nil
}.result
try await super.tearDown()
}

@MainActor
Expand Down
27 changes: 19 additions & 8 deletions Tests/NodesTests/CoreTests/AbstractContextTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,27 @@ final class AbstractContextTests: XCTestCase, TestCaseHelpers {
private var mockWorkers: [WorkerMock]!
private var mockCancellables: [CancellableMock]!

@MainActor
override func setUp() {
super.setUp()
tearDown(keyPath: \.mockWorkers, initialValue: [WorkerMock(), WorkerMock(), WorkerMock()])
tearDown(keyPath: \.mockCancellables, initialValue: [CancellableMock(), CancellableMock(), CancellableMock()])
override func setUp() async throws {
try await super.setUp()
struct Box<T: XCTestCase>: @unchecked Sendable {
let testCase: T
}
let box: Box<AbstractContextTests> = .init(testCase: self)
_ = await Task { @MainActor in
let testCase: AbstractContextTests = box.testCase
testCase.tearDown(
keyPath: \.mockWorkers,
initialValue: [WorkerMock(), WorkerMock(), WorkerMock()]
)
testCase.tearDown(
keyPath: \.mockCancellables,
initialValue: [CancellableMock(), CancellableMock(), CancellableMock()]
)
}.result
}

@MainActor
override func tearDown() {
super.tearDown()
override func tearDown() async throws {
try await super.tearDown()
}

@MainActor
Expand Down
26 changes: 17 additions & 9 deletions Tests/NodesTests/CoreTests/AbstractFlowTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,23 @@ final class AbstractFlowTests: XCTestCase, TestCaseHelpers {

private var mockFlows: [FlowMock]!

@MainActor
override func setUp() {
super.setUp()
tearDown(keyPath: \.mockFlows, initialValue: [FlowMock(), FlowMock(), FlowMock()])
}

@MainActor
override func tearDown() {
super.tearDown()
override func setUp() async throws {
try await super.setUp()
struct Box<T: XCTestCase>: @unchecked Sendable {
let testCase: T
}
let box: Box<AbstractFlowTests> = .init(testCase: self)
_ = await Task { @MainActor in
let testCase: AbstractFlowTests = box.testCase
testCase.tearDown(
keyPath: \.mockFlows,
initialValue: [FlowMock(), FlowMock(), FlowMock()]
)
}.result
}

override func tearDown() async throws {
try await super.tearDown()
}

@MainActor
Expand Down
22 changes: 15 additions & 7 deletions Tests/NodesTests/CoreTests/AbstractWorkerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,23 @@ final class AbstractWorkerTests: XCTestCase, TestCaseHelpers {

private var mockCancellables: [CancellableMock]!

@MainActor
override func setUp() {
super.setUp()
tearDown(keyPath: \.mockCancellables, initialValue: [CancellableMock(), CancellableMock(), CancellableMock()])
override func setUp() async throws {
try await super.setUp()
struct Box<T: XCTestCase>: @unchecked Sendable {
let testCase: T
}
let box: Box<AbstractWorkerTests> = .init(testCase: self)
_ = await Task { @MainActor in
let testCase: AbstractWorkerTests = box.testCase
testCase.tearDown(
keyPath: \.mockCancellables,
initialValue: [CancellableMock(), CancellableMock(), CancellableMock()]
)
}.result
}

@MainActor
override func tearDown() {
super.tearDown()
override func tearDown() async throws {
try await super.tearDown()
}

@MainActor
Expand Down
22 changes: 15 additions & 7 deletions Tests/NodesTests/InternalTests/FlowControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@ final class FlowControllerTests: XCTestCase, TestCaseHelpers {

private var mockFlows: [FlowMock]!

@MainActor
override func setUp() {
super.setUp()
tearDown(keyPath: \.mockFlows, initialValue: [FlowMock(), FlowMock(), FlowMock()])
override func setUp() async throws {
try await super.setUp()
struct Box<T: XCTestCase>: @unchecked Sendable {
let testCase: T
}
let box: Box<FlowControllerTests> = .init(testCase: self)
_ = await Task { @MainActor in
let testCase: FlowControllerTests = box.testCase
testCase.tearDown(
keyPath: \.mockFlows,
initialValue: [FlowMock(), FlowMock(), FlowMock()]
)
}.result
}

@MainActor
override func tearDown() {
super.tearDown()
override func tearDown() async throws {
try await super.tearDown()
}

@MainActor
Expand Down
22 changes: 15 additions & 7 deletions Tests/NodesTests/InternalTests/WorkerControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@ final class WorkerControllerTests: XCTestCase, TestCaseHelpers {

private var mockWorkers: [WorkerMock]!

@MainActor
override func setUp() {
super.setUp()
tearDown(keyPath: \.mockWorkers, initialValue: [WorkerMock(), WorkerMock(), WorkerMock()])
override func setUp() async throws {
try await super.setUp()
struct Box<T: XCTestCase>: @unchecked Sendable {
let testCase: T
}
let box: Box<WorkerControllerTests> = .init(testCase: self)
_ = await Task { @MainActor in
let testCase: WorkerControllerTests = box.testCase
testCase.tearDown(
keyPath: \.mockWorkers,
initialValue: [WorkerMock(), WorkerMock(), WorkerMock()]
)
}.result
}

@MainActor
override func tearDown() {
super.tearDown()
override func tearDown() async throws {
try await super.tearDown()
}

@MainActor
Expand Down
Loading