@@ -2,8 +2,8 @@ import Combine
22import ComposableArchitecture
33import XCTest
44
5- @MainActor
65final class SharedTests : XCTestCase {
6+ @MainActor
77 func testSharing( ) async {
88 let store = TestStore (
99 initialState: SharedFeature . State (
@@ -24,6 +24,7 @@ final class SharedTests: XCTestCase {
2424 XCTAssertEqual ( store. state. profile. stats. count, 1 )
2525 }
2626
27+ @MainActor
2728 func testSharing_Failure( ) async {
2829 let store = TestStore (
2930 initialState: SharedFeature . State (
@@ -55,6 +56,7 @@ final class SharedTests: XCTestCase {
5556 XCTAssertEqual ( store. state. sharedCount, 1 )
5657 }
5758
59+ @MainActor
5860 func testSharing_NonExhaustive( ) async {
5961 let store = TestStore (
6062 initialState: SharedFeature . State (
@@ -91,6 +93,7 @@ final class SharedTests: XCTestCase {
9193 XCTAssertEqual ( store. state. sharedCount, 2 )
9294 }
9395
96+ @MainActor
9497 func testMultiSharing( ) async {
9598 @Shared ( Stats ( ) ) var stats
9699
@@ -110,6 +113,7 @@ final class SharedTests: XCTestCase {
110113 XCTAssertEqual ( stats. count, 2 )
111114 }
112115
116+ @MainActor
113117 func testIncrementalMutation( ) async {
114118 let store = TestStore (
115119 initialState: SharedFeature . State (
@@ -155,6 +159,7 @@ final class SharedTests: XCTestCase {
155159 }
156160 }
157161
162+ @MainActor
158163 func testEffect( ) async {
159164 let store = TestStore (
160165 initialState: SharedFeature . State (
@@ -171,6 +176,7 @@ final class SharedTests: XCTestCase {
171176 }
172177 }
173178
179+ @MainActor
174180 func testEffect_Failure( ) async {
175181 let store = TestStore (
176182 initialState: SharedFeature . State (
@@ -200,6 +206,7 @@ final class SharedTests: XCTestCase {
200206 await store. receive ( \. sharedIncrement)
201207 }
202208
209+ @MainActor
203210 func testMutationOfSharedStateInLongLivingEffect( ) async {
204211 let store = TestStore (
205212 initialState: SharedFeature . State (
@@ -218,6 +225,7 @@ final class SharedTests: XCTestCase {
218225 }
219226 }
220227
228+ @MainActor
221229 func testMutationOfSharedStateInLongLivingEffect_NoAssertion( ) async {
222230 let sharedCountInitLine = #line + 4
223231 let store = TestStore (
@@ -249,6 +257,7 @@ final class SharedTests: XCTestCase {
249257 await store. send ( . longLivingEffect)
250258 }
251259
260+ @MainActor
252261 func testMutationOfSharedStateInLongLivingEffect_IncorrectAssertion( ) async {
253262 let store = TestStore (
254263 initialState: SharedFeature . State (
@@ -277,6 +286,7 @@ final class SharedTests: XCTestCase {
277286 }
278287 }
279288
289+ @MainActor
280290 func testComplexSharedEffect_ReducerMutation( ) async {
281291 struct Feature : Reducer {
282292 struct State : Equatable {
@@ -323,6 +333,7 @@ final class SharedTests: XCTestCase {
323333 await mainQueue. advance ( by: . seconds( 1 ) )
324334 }
325335
336+ @MainActor
326337 func testComplexSharedEffect_EffectMutation( ) async {
327338 struct Feature : Reducer {
328339 struct State : Equatable {
@@ -380,6 +391,7 @@ final class SharedTests: XCTestCase {
380391 }
381392 }
382393
394+ @MainActor
383395 func testDump( ) {
384396 @Shared ( Profile ( stats: Shared ( Stats ( ) ) ) ) var profile : Profile
385397 XCTAssertEqual (
@@ -400,6 +412,7 @@ final class SharedTests: XCTestCase {
400412 )
401413 }
402414
415+ @MainActor
403416 func testSimpleFeatureFailure( ) async {
404417 let store = TestStore ( initialState: SimpleFeature . State ( count: Shared ( 0 ) ) ) {
405418 SimpleFeature ( )
@@ -435,6 +448,7 @@ final class SharedTests: XCTestCase {
435448 }
436449
437450 @available ( * , deprecated)
451+ @MainActor
438452 func testObservation_Object( ) {
439453 @Shared var object : SharedObject
440454 _object = Shared ( SharedObject ( ) )
@@ -448,6 +462,7 @@ final class SharedTests: XCTestCase {
448462 self . wait ( for: [ countDidChange] , timeout: 0 )
449463 }
450464
465+ @MainActor
451466 func testAssertSharedStateWithNoChanges( ) {
452467 let store = TestStore ( initialState: SimpleFeature . State ( count: Shared ( 0 ) ) ) {
453468 SimpleFeature ( )
@@ -462,6 +477,7 @@ final class SharedTests: XCTestCase {
462477 }
463478 }
464479
480+ @MainActor
465481 func testPublisher( ) {
466482 var cancellables : Set < AnyCancellable > = [ ]
467483 defer { _ = cancellables }
@@ -480,6 +496,7 @@ final class SharedTests: XCTestCase {
480496 XCTAssertEqual ( counts, [ 1 , 2 ] )
481497 }
482498
499+ @MainActor
483500 func testPublisher_MultipleSubscribers( ) {
484501 var cancellables : Set < AnyCancellable > = [ ]
485502 defer { _ = cancellables }
@@ -503,6 +520,7 @@ final class SharedTests: XCTestCase {
503520 XCTAssertEqual ( counts, [ 1 , 1 , 2 , 2 ] )
504521 }
505522
523+ @MainActor
506524 func testPublisher_MutateInSink( ) {
507525 var cancellables : Set < AnyCancellable > = [ ]
508526 defer { _ = cancellables }
@@ -522,6 +540,7 @@ final class SharedTests: XCTestCase {
522540 XCTAssertEqual ( counts, [ 1 , 2 ] )
523541 }
524542
543+ @MainActor
525544 func testPublisher_Persistence_MutateInSink( ) {
526545 var cancellables : Set < AnyCancellable > = [ ]
527546 defer { _ = cancellables }
@@ -543,6 +562,7 @@ final class SharedTests: XCTestCase {
543562 XCTAssertEqual ( userDefaults. integer ( forKey: " count " ) , 2 )
544563 }
545564
565+ @MainActor
546566 func testPublisher_Persistence_ExternalChange( ) async throws {
547567 @Dependency ( \. defaultAppStorage) var defaults
548568 @Shared ( . appStorage( " count " ) ) var count = 0
@@ -566,6 +586,7 @@ final class SharedTests: XCTestCase {
566586 XCTAssertEqual ( defaults. integer ( forKey: " count " ) , 2 )
567587 }
568588
589+ @MainActor
569590 func testMultiplePublisherSubscriptions( ) async {
570591 let runCount = 1_000
571592 for _ in 1 ... runCount {
@@ -596,6 +617,7 @@ final class SharedTests: XCTestCase {
596617 }
597618 }
598619
620+ @MainActor
599621 func testEarlySharedStateMutation( ) async {
600622 let store = TestStore ( initialState: EarlySharedStateMutation . State ( count: Shared ( 0 ) ) ) {
601623 EarlySharedStateMutation ( )
0 commit comments