From 28094b0b74ea2c26003dee4d2b916a3943027ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?jean=2E333=28=E1=84=8C=E1=85=A5=E1=86=BC=E1=84=8B=E1=85=B2?= =?UTF-8?q?=E1=84=8C=E1=85=B5=E1=86=AB=29/kakaomobility?= <41438361+Yoojin99@users.noreply.github.com> Date: Thu, 26 Feb 2026 15:14:18 +0900 Subject: [PATCH 1/2] Fix Tests group path in Xcode project --- SwiftyJSON.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SwiftyJSON.xcodeproj/project.pbxproj b/SwiftyJSON.xcodeproj/project.pbxproj index ec223336..3c325ac2 100644 --- a/SwiftyJSON.xcodeproj/project.pbxproj +++ b/SwiftyJSON.xcodeproj/project.pbxproj @@ -278,7 +278,7 @@ 2E4FEFEB19575BE100351305 /* Supporting Files */, ); name = Tests; - path = Tests/Tes; + path = Tests/SwiftJSONTests; sourceTree = ""; }; 2E4FEFEB19575BE100351305 /* Supporting Files */ = { From d9712989ba2275f2d04e62a9fa74e704bc54fdda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?jean=2E333=28=E1=84=8C=E1=85=A5=E1=86=BC=E1=84=8B=E1=85=B2?= =?UTF-8?q?=E1=84=8C=E1=85=B5=E1=86=AB=29/kakaomobility?= <41438361+Yoojin99@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:06:37 +0900 Subject: [PATCH 2/2] Fix test resource loading for Xcode and SwiftPM --- Tests/SwiftJSONTests/BaseTests.swift | 9 ++++++--- Tests/SwiftJSONTests/PerformanceTests.swift | 7 ++++++- Tests/SwiftJSONTests/SequenceTypeTests.swift | 7 ++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Tests/SwiftJSONTests/BaseTests.swift b/Tests/SwiftJSONTests/BaseTests.swift index 634e1c8b..8bbebcde 100644 --- a/Tests/SwiftJSONTests/BaseTests.swift +++ b/Tests/SwiftJSONTests/BaseTests.swift @@ -31,9 +31,12 @@ class BaseTests: XCTestCase { super.setUp() -// let file = "./Tests/Tes/Tests.json" -// self.testData = try? Data(contentsOf: URL(fileURLWithPath: file)) - if let file = Bundle.module.url(forResource: "Tests", withExtension: "json") { + #if SWIFT_PACKAGE + let testBundle = Bundle.module + #else + let testBundle = Bundle(for: BaseTests.self) + #endif + if let file = testBundle.url(forResource: "Tests", withExtension: "json") { self.testData = try? Data(contentsOf: file) } else { XCTFail("Can't find the test JSON file") diff --git a/Tests/SwiftJSONTests/PerformanceTests.swift b/Tests/SwiftJSONTests/PerformanceTests.swift index 70f1f2f2..c0e6cc0b 100644 --- a/Tests/SwiftJSONTests/PerformanceTests.swift +++ b/Tests/SwiftJSONTests/PerformanceTests.swift @@ -30,7 +30,12 @@ class PerformanceTests: XCTestCase { override func setUp() { super.setUp() - if let file = Bundle.module.url(forResource: "Tests", withExtension: "json") { + #if SWIFT_PACKAGE + let testBundle = Bundle.module + #else + let testBundle = Bundle(for: PerformanceTests.self) + #endif + if let file = testBundle.url(forResource: "Tests", withExtension: "json") { self.testData = try? Data(contentsOf: file) } else { XCTFail("Can't find the test JSON file") diff --git a/Tests/SwiftJSONTests/SequenceTypeTests.swift b/Tests/SwiftJSONTests/SequenceTypeTests.swift index 557c3dbb..a039453f 100644 --- a/Tests/SwiftJSONTests/SequenceTypeTests.swift +++ b/Tests/SwiftJSONTests/SequenceTypeTests.swift @@ -28,7 +28,12 @@ class SequenceTypeTests: XCTestCase { var testData: Data? func testJSONFile() { - if let file = Bundle.module.url(forResource: "Tests", withExtension: "json") { + #if SWIFT_PACKAGE + let testBundle = Bundle.module + #else + let testBundle = Bundle(for: SequenceTypeTests.self) + #endif + if let file = testBundle.url(forResource: "Tests", withExtension: "json") { self.testData = try? Data(contentsOf: file) guard let json = try? JSON(data: self.testData!) else { XCTFail("Unable to parse the data")