Skip to content

Commit f3b6a12

Browse files
committed
Move XCTAssertThrowsErrorAsync to new target TestUtils
1 parent 63ce407 commit f3b6a12

File tree

7 files changed

+26
-12
lines changed

7 files changed

+26
-12
lines changed

OAuth2.xcodeproj/project.pbxproj

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
87FABDD72DC8FA8100E0C67B /* OAuth2ImplicitGrantWithQueryParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87FABDD62DC8FA8100E0C67B /* OAuth2ImplicitGrantWithQueryParams.swift */; };
5151
87FABDD82DC8FA8100E0C67B /* OAuth2ImplicitGrantWithQueryParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87FABDD62DC8FA8100E0C67B /* OAuth2ImplicitGrantWithQueryParams.swift */; };
5252
87FABDD92DC8FA8100E0C67B /* OAuth2ImplicitGrantWithQueryParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87FABDD62DC8FA8100E0C67B /* OAuth2ImplicitGrantWithQueryParams.swift */; };
53+
87FABDDD2DC9F2DF00E0C67B /* OAuth2Actor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87FABDDC2DC9F2DF00E0C67B /* OAuth2Actor.swift */; };
54+
87FABDDE2DC9F2DF00E0C67B /* OAuth2Actor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87FABDDC2DC9F2DF00E0C67B /* OAuth2Actor.swift */; };
55+
87FABDDF2DC9F2DF00E0C67B /* OAuth2Actor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87FABDDC2DC9F2DF00E0C67B /* OAuth2Actor.swift */; };
5356
CCCE40D6B4EAD9BF05C92ACE /* OAuth2CustomAuthorizer+iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCCE4C8DC3CB7713E59BC1EE /* OAuth2CustomAuthorizer+iOS.swift */; };
5457
DD0CCBAD1C4DC83A0044C4E3 /* OAuth2WebViewController+macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD0CCBAC1C4DC83A0044C4E3 /* OAuth2WebViewController+macOS.swift */; };
5558
EA9758181B222CEA007744B1 /* OAuth2PasswordGrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA9758171B222CEA007744B1 /* OAuth2PasswordGrant.swift */; };
@@ -193,6 +196,7 @@
193196
87B3E07B29F6AF240075C4DC /* OAuth2DeviceGrantTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OAuth2DeviceGrantTests.swift; sourceTree = "<group>"; };
194197
87FABDD22DC8D77000E0C67B /* XCTAssertThrowsErrorAsync.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCTAssertThrowsErrorAsync.swift; sourceTree = "<group>"; };
195198
87FABDD62DC8FA8100E0C67B /* OAuth2ImplicitGrantWithQueryParams.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OAuth2ImplicitGrantWithQueryParams.swift; sourceTree = "<group>"; };
199+
87FABDDC2DC9F2DF00E0C67B /* OAuth2Actor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OAuth2Actor.swift; sourceTree = "<group>"; };
196200
CCCE4C8DC3CB7713E59BC1EE /* OAuth2CustomAuthorizer+iOS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OAuth2CustomAuthorizer+iOS.swift"; sourceTree = "<group>"; };
197201
DD0CCBAC1C4DC83A0044C4E3 /* OAuth2WebViewController+macOS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "OAuth2WebViewController+macOS.swift"; sourceTree = "<group>"; };
198202
EA9758171B222CEA007744B1 /* OAuth2PasswordGrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = OAuth2PasswordGrant.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
@@ -311,12 +315,12 @@
311315
path = Constants;
312316
sourceTree = "<group>";
313317
};
314-
87FABDD52DC8D7C300E0C67B /* Utils */ = {
318+
87FABDDB2DC9F18F00E0C67B /* TestUtils */ = {
315319
isa = PBXGroup;
316320
children = (
317321
87FABDD22DC8D77000E0C67B /* XCTAssertThrowsErrorAsync.swift */,
318322
);
319-
path = Utils;
323+
path = TestUtils;
320324
sourceTree = "<group>";
321325
};
322326
EE2486281AC85DD4002B31AF /* iOS */ = {
@@ -332,6 +336,7 @@
332336
EE2983731D40BC8900933CDD /* Base */ = {
333337
isa = PBXGroup;
334338
children = (
339+
87FABDDC2DC9F2DF00E0C67B /* OAuth2Actor.swift */,
335340
EEDB8640193FAB9200C4EEA1 /* OAuth2Base.swift */,
336341
EE9EBF1A1D775F74003263FC /* OAuth2Securable.swift */,
337342
EEF47D2A1B1E3FDD0057D838 /* OAuth2Requestable.swift */,
@@ -466,6 +471,7 @@
466471
EE2486281AC85DD4002B31AF /* iOS */,
467472
EEC7A8C51AE46C33008C30E7 /* macOS */,
468473
65D294B91C57CB47009DA970 /* tvOS */,
474+
87FABDDB2DC9F18F00E0C67B /* TestUtils */,
469475
EEDB8627193FAAE500C4EEA1 /* Supporting Files */,
470476
);
471477
name = OAuth2;
@@ -489,7 +495,6 @@
489495
EE4EBD801D7FF38200E6A9CA /* Flows */,
490496
EEB9A9811D86CD540022EF66 /* DataLoader */,
491497
EEE209A419427DFE00736F1A /* Supporting Files */,
492-
87FABDD52DC8D7C300E0C67B /* Utils */,
493498
);
494499
path = Tests;
495500
sourceTree = "<group>";
@@ -723,6 +728,7 @@
723728
6598544E1C5B3C9500237D39 /* OAuth2Authorizer+tvOS.swift in Sources */,
724729
EE9EBF151D775A21003263FC /* OAuth2DataLoader.swift in Sources */,
725730
EE1070361E5C7A4200250586 /* OAuth2CustomAuthorizerUI.swift in Sources */,
731+
87FABDDE2DC9F2DF00E0C67B /* OAuth2Actor.swift in Sources */,
726732
EEAEF10D1CDBCF28001A1C6F /* OAuth2Logger.swift in Sources */,
727733
EE9EBF1D1D775F74003263FC /* OAuth2Securable.swift in Sources */,
728734
659854521C5B3C9C00237D39 /* OAuth2AuthConfig.swift in Sources */,
@@ -741,6 +747,7 @@
741747
EEAEF10C1CDBCF28001A1C6F /* OAuth2Logger.swift in Sources */,
742748
EE20118D1E44D0BD00913FA7 /* OAuth2DataLoaderSessionTaskDelegate.swift in Sources */,
743749
65EC05E11C9050CB00DE9186 /* OAuth2KeychainAccount.swift in Sources */,
750+
87FABDDF2DC9F2DF00E0C67B /* OAuth2Actor.swift in Sources */,
744751
EE86C4661C48F6AC00B7D486 /* OAuth2CodeGrantNoTokenType.swift in Sources */,
745752
EE9EBF1C1D775F74003263FC /* OAuth2Securable.swift in Sources */,
746753
EEF47D2C1B1E3FDD0057D838 /* OAuth2Requestable.swift in Sources */,
@@ -808,6 +815,7 @@
808815
EEACE1D61A7E8DEB009BF3A7 /* OAuth2ImplicitGrant.swift in Sources */,
809816
EEFD23511C9ED9E400727DCF /* OAuth2ClientCredentialsReddit.swift in Sources */,
810817
EE2983701D40B83600933CDD /* OAuth2.swift in Sources */,
818+
87FABDDD2DC9F2DF00E0C67B /* OAuth2Actor.swift in Sources */,
811819
EEB9A97C1D86C34E0022EF66 /* OAuth2Response.swift in Sources */,
812820
EEACE1D81A7E8DEE009BF3A7 /* OAuth2CodeGrant.swift in Sources */,
813821
EE9EBF131D775A21003263FC /* OAuth2DataLoader.swift in Sources */,

Package.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ let package = Package(
4343
.target(name: "Flows", dependencies: [
4444
.target(name: "macOS"), .target(name: "iOS"), .target(name: "tvOS"), .target(name: "Constants")]),
4545
.target(name: "DataLoader", dependencies: [.target(name: "Flows")]),
46-
.testTarget(name: "BaseTests", dependencies: [.target(name: "Base"), .target(name: "Flows")]),
47-
.testTarget(name: "FlowTests", dependencies: [.target(name: "Flows")]),
46+
.target(name: "TestUtils", dependencies: [.target(name: "Base")]),
47+
.testTarget(name: "BaseTests", dependencies: [.target(name: "TestUtils"), .target(name: "Base"), .target(name: "Flows")]),
48+
.testTarget(name: "FlowTests", dependencies: [.target(name: "TestUtils"), .target(name: "Flows")]),
4849
// .testTarget(name: "DataLoaderTests", dependencies: [.target(name: "DataLoader")]),
4950
]
5051
)

Sources/Base/OAuth2Actor.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@globalActor public actor OAuth2Actor : GlobalActor {
2+
public static let shared = OAuth2Actor()
3+
}

Sources/Base/OAuth2Base.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@
2121
import Foundation
2222
import CommonCrypto
2323

24-
25-
@globalActor public actor OAuth2Actor : GlobalActor {
26-
public static let shared = OAuth2Actor()
27-
}
28-
2924
/**
3025
Class extending on OAuth2Requestable, exposing configuration and maintaining context, serving as base class for `OAuth2`.
3126
*/

Tests/Utils/XCTAssertThrowsErrorAsync.swift renamed to Sources/TestUtils/XCTAssertThrowsErrorAsync.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
import XCTest
1+
#if !NO_MODULE_IMPORT
2+
import Base
3+
#else
24
import OAuth2
5+
#endif
6+
7+
import XCTest
38

49
/// Asserts that an asynchronous expression throws an error.
510
/// (Intended to function as a drop-in asynchronous version of `XCTAssertThrowsError`.)
@@ -21,7 +26,7 @@ import OAuth2
2126
/// The default is the line number where you call this function.
2227
/// - errorHandler: An optional handler for errors that expression throws.
2328
@OAuth2Actor
24-
func XCTAssertThrowsErrorAsync<T: Sendable>(
29+
public func XCTAssertThrowsErrorAsync<T: Sendable>(
2530
_ expression: @autoclosure () async throws -> T,
2631
_ message: @autoclosure () -> String = "",
2732
file: StaticString = #filePath,

Tests/FlowTests/OAuth2CodeGrantTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import XCTest
2525
import Base
2626
@testable
2727
import Flows
28+
import TestUtils
2829
#else
2930
@testable
3031
import OAuth2

Tests/FlowTests/OAuth2ImplicitGrantTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import XCTest
2525
import Base
2626
@testable
2727
import Flows
28+
import TestUtils
2829
#else
2930
@testable
3031
import OAuth2

0 commit comments

Comments
 (0)