From 457a15cbb15e88187f7d1f9f2c7d7bf6bc1f101d Mon Sep 17 00:00:00 2001 From: Sam Deane Date: Thu, 19 Dec 2024 15:12:09 +0000 Subject: [PATCH] Only register suites that contain EmbeddedTestCase tests. (#632) --- .../EmbeddedXCTest/EmbeddedTestCase.swift | 6 +++++- .../EmbeddedXCTest/EmbeddingController.swift | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/SwiftGodotTestability/EmbeddedXCTest/EmbeddedTestCase.swift b/Sources/SwiftGodotTestability/EmbeddedXCTest/EmbeddedTestCase.swift index 06663d429..1a2d2ad8a 100644 --- a/Sources/SwiftGodotTestability/EmbeddedXCTest/EmbeddedTestCase.swift +++ b/Sources/SwiftGodotTestability/EmbeddedXCTest/EmbeddedTestCase.swift @@ -8,12 +8,16 @@ import XCTest +/// Non-generic base class for EmbeddedTestCase. +open class EmbeddedTestBase: XCTestCase { +} + /// Superclass for test cases that are embedded. /// /// When running normally, the tests will be silent and will do nothing. /// When re-run the embedded context, the test case will perform its normal /// actions. -open class EmbeddedTestCase: XCTestCase { +open class EmbeddedTestCase: EmbeddedTestBase { override open var name: String { return EmbeddingController.isRunningEmbedded ? "Embedded(\(super.name))" : super.name } diff --git a/Sources/SwiftGodotTestability/EmbeddedXCTest/EmbeddingController.swift b/Sources/SwiftGodotTestability/EmbeddedXCTest/EmbeddingController.swift index 1c3e64a07..b8e057fb2 100644 --- a/Sources/SwiftGodotTestability/EmbeddedXCTest/EmbeddingController.swift +++ b/Sources/SwiftGodotTestability/EmbeddedXCTest/EmbeddingController.swift @@ -63,7 +63,7 @@ public class EmbeddingController: NSObject, XCTestObservation { /// Record a test suite that has finished running. func registerSuite(_ suite: XCTestSuite) { if !isRunningEmbedded { - if let test = suite.tests.first as? XCTestCase { + if let test = suite.tests.first as? EmbeddedTestBase { let testClass = type(of: test) let injected = EmbeddedTestCaseSuite(for: testClass, tests: suite.tests) embeddedSuite.addTest(injected) @@ -107,8 +107,6 @@ public class EmbeddingController: NSObject, XCTestObservation { public func testSuiteDidFinish(_ testSuite: XCTestSuite) { if testSuite.className == "XCTestCaseSuite" { registerSuite(testSuite) - // } else { - // print("SKIPPED \(testSuite) \(type(of: testSuite))") } }