From 396593960a0e8c568454a15e8d971c9c6061fc69 Mon Sep 17 00:00:00 2001 From: Adam Fowler Date: Thu, 1 Aug 2024 12:37:34 +0000 Subject: [PATCH] Only use URLSession.shared.data in Swift 6.0 or above --- Tests/JMESPathTests/ComplianceTests.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Tests/JMESPathTests/ComplianceTests.swift b/Tests/JMESPathTests/ComplianceTests.swift index 17be7bd..2bc39c7 100644 --- a/Tests/JMESPathTests/ComplianceTests.swift +++ b/Tests/JMESPathTests/ComplianceTests.swift @@ -150,7 +150,11 @@ final class ComplianceTests: XCTestCase { } func testCompliance(url: URL, ignoring: [String] = []) async throws { - let (data, _) = try await URLSession.shared.data(from: url, delegate: nil) + #if swift(>=6.0) + let (data, _) = try await URLSession.shared.data(from: url, delegate: nil) + #else + let data = try Data(contentsOf: url) + #endif let tests = try JSONDecoder().decode([ComplianceTest].self, from: data) if #available(iOS 11.0, tvOS 11.0, watchOS 5.0, *) {