From 57b6c0c3e56e4d2627ebe02a3d311c2569ded61a Mon Sep 17 00:00:00 2001 From: Jonathan Flat <50605158+jrflat@users.noreply.github.com> Date: Thu, 25 Sep 2025 11:15:52 -0600 Subject: [PATCH] Prevent nil force unwrap in JSONEncoder test (#1523) --- Tests/FoundationEssentialsTests/JSONEncoderTests.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tests/FoundationEssentialsTests/JSONEncoderTests.swift b/Tests/FoundationEssentialsTests/JSONEncoderTests.swift index 696ecb117..566919ece 100644 --- a/Tests/FoundationEssentialsTests/JSONEncoderTests.swift +++ b/Tests/FoundationEssentialsTests/JSONEncoderTests.swift @@ -2621,7 +2621,10 @@ extension JSONEncoderTests { func _run_json5SpecTest(_ category: String, _ name: String, testType: JSON5SpecTestType, type: T.Type, sourceLocation: SourceLocation = #_sourceLocation) { let subdirectory = "/JSON5/spec/\(category)" let ext = testType.fileExtension - let jsonData = testData(forResource: name, withExtension: ext, subdirectory: subdirectory)! + guard let jsonData = testData(forResource: name, withExtension: ext, subdirectory: subdirectory) else { + Issue.record("Failed to load test data forResource: \(name), withExtension: \(ext), subdirectory: \(subdirectory)", sourceLocation: sourceLocation) + return + } let json5 = json5Decoder let json = JSONDecoder()