@@ -16,7 +16,7 @@ import StdlibUnittest
16
16
17
17
func checkAssumeMainActor( echo: MainActorEcho ) /* synchronous! */ {
18
18
// Echo.get("any") // error: main actor isolated, cannot perform async call here
19
- _assumeOnMainActorExecutor {
19
+ assumeOnMainActorExecutor {
20
20
let input = " example "
21
21
let got = echo. get ( input)
22
22
precondition ( got == " example " , " Expected echo to match \( input) " )
@@ -40,7 +40,7 @@ actor MainFriend {
40
40
41
41
func checkAssumeSomeone( someone: Someone ) /* synchronous */ {
42
42
// someone.something // can't access, would need a hop but we can't
43
- _assumeOnActorExecutor ( someone) { someone in
43
+ assumeOnActorExecutor ( someone) { someone in
44
44
let something = someone. something
45
45
let expected = " isolated something "
46
46
precondition ( something == expected, " expected ' \( expected) ', got: \( something) " )
@@ -103,45 +103,45 @@ final class MainActorEcho {
103
103
if #available( SwiftStdlib 5 . 9 , * ) {
104
104
// === MainActor --------------------------------------------------------
105
105
106
- tests. test ( " _assumeOnMainActorExecutor : assume the main executor, from 'main() async'" ) {
106
+ tests. test ( " assumeOnMainActorExecutor : assume the main executor, from 'main() async'" ) {
107
107
await checkAssumeMainActor ( echo: echo)
108
108
}
109
109
110
- tests. test ( " _assumeOnMainActorExecutor : assume the main executor, from MainActor method" ) {
110
+ tests. test ( " assumeOnMainActorExecutor : assume the main executor, from MainActor method" ) {
111
111
await mainActorCallCheck ( echo: echo)
112
112
}
113
113
114
- tests. test ( " _assumeOnMainActorExecutor : assume the main executor, from actor on MainActor executor" ) {
114
+ tests. test ( " assumeOnMainActorExecutor : assume the main executor, from actor on MainActor executor" ) {
115
115
await MainFriend ( ) . callCheck ( echo: echo)
116
116
}
117
117
118
- tests. test ( " _assumeOnMainActorExecutor : wrongly assume the main executor, from actor on other executor" ) {
118
+ tests. test ( " assumeOnMainActorExecutor : wrongly assume the main executor, from actor on other executor" ) {
119
119
expectCrashLater ( withMessage: " Incorrect actor executor assumption; Expected 'MainActor' executor. " )
120
120
await Someone ( ) . callCheckMainActor ( echo: echo)
121
121
}
122
122
123
123
// === some Actor -------------------------------------------------------
124
124
125
125
let someone = Someone ( )
126
- tests. test ( " _assumeOnActorExecutor : wrongly assume someone's executor, from 'main() async'" ) {
126
+ tests. test ( " assumeOnActorExecutor : wrongly assume someone's executor, from 'main() async'" ) {
127
127
expectCrashLater ( withMessage: " Incorrect actor executor assumption; Expected same executor as a.Someone. " )
128
128
checkAssumeSomeone ( someone: someone)
129
129
}
130
130
131
- tests. test ( " _assumeOnActorExecutor : wrongly assume someone's executor, from MainActor method" ) {
131
+ tests. test ( " assumeOnActorExecutor : wrongly assume someone's executor, from MainActor method" ) {
132
132
expectCrashLater ( withMessage: " Incorrect actor executor assumption; Expected same executor as a.Someone. " )
133
133
checkAssumeSomeone ( someone: someone)
134
134
}
135
135
136
- tests. test ( " _assumeOnActorExecutor : assume someone's executor, from Someone" ) {
136
+ tests. test ( " assumeOnActorExecutor : assume someone's executor, from Someone" ) {
137
137
await someone. callCheckSomeone ( )
138
138
}
139
139
140
- tests. test ( " _assumeOnActorExecutor : assume someone's executor, from actor on the Someone.unownedExecutor" ) {
140
+ tests. test ( " assumeOnActorExecutor : assume someone's executor, from actor on the Someone.unownedExecutor" ) {
141
141
await SomeonesFriend ( someone: someone) . callCheckSomeone ( )
142
142
}
143
143
144
- tests. test ( " _assumeOnActorExecutor : wrongly assume the main executor, from actor on other executor" ) {
144
+ tests. test ( " assumeOnActorExecutor : wrongly assume the main executor, from actor on other executor" ) {
145
145
expectCrashLater ( withMessage: " Incorrect actor executor assumption; Expected same executor as a.Someone. " )
146
146
await CompleteStranger ( someone: someone) . callCheckSomeone ( )
147
147
}
0 commit comments