@@ -563,22 +563,14 @@ class ExpectationsTestCase: XCTestCase {
563563
564564// CHECK: Test Case 'ExpectationsTestCase.test_waitForExpectationsFromMainActor' started at \d+-\d+-\d+ \d+:\d+:\d+\.\d+
565565// CHECK: Test Case 'ExpectationsTestCase.test_waitForExpectationsFromMainActor' passed \(\d+\.\d+ seconds\)
566- @MainActor func test_waitForExpectationsFromMainActor( ) {
567- // Basic check that waitForExpectations() is functional and does not need
568- // the await keyword when used from a main-actor-isolated test function.
569- let expectation = self . expectation ( description: " foo " )
570- expectation. fulfill ( )
571- self . waitForExpectations ( timeout: 0.0 )
572- }
573-
574- // CHECK: Test Case 'ExpectationsTestCase.test_waitForExpectationsFromMainActor_async' started at \d+-\d+-\d+ \d+:\d+:\d+\.\d+
575- // CHECK: Test Case 'ExpectationsTestCase.test_waitForExpectationsFromMainActor_async' passed \(\d+\.\d+ seconds\)
576- @MainActor func test_waitForExpectationsFromMainActor_async( ) async {
577- // Basic check that waitForExpectations() is functional and does not need
578- // the await keyword when used from a main-actor-isolated test function.
579- let expectation = self . expectation ( description: " foo " )
580- expectation. fulfill ( )
581- self . waitForExpectations ( timeout: 0.0 )
566+ func test_waitForExpectationsFromMainActor( ) async {
567+ await MainActor . run {
568+ // Basic check that waitForExpectations() is functional and does not need
569+ // the await keyword when used from a main-actor-isolated test function.
570+ let expectation = self . expectation ( description: " foo " )
571+ expectation. fulfill ( )
572+ self . waitForExpectations ( timeout: 0.0 )
573+ }
582574 }
583575
584576 static var allTests = {
@@ -636,9 +628,7 @@ class ExpectationsTestCase: XCTestCase {
636628
637629 // waitForExpectations() + @MainActor
638630 ( " test_waitForExpectationsAsync " , asyncTest ( test_waitForExpectationsAsync) ) ,
639- // Disabled due to a SILGen crash: <rdar://111340003>
640- // ("test_waitForExpectationsFromMainActor", asyncTest(test_waitForExpectationsFromMainActor)),
641- // ("test_waitForExpectationsFromMainActor_async", asyncTest(test_waitForExpectationsFromMainActor_async)),
631+ ( " test_waitForExpectationsFromMainActor " , asyncTest ( test_waitForExpectationsFromMainActor) ) ,
642632 ]
643633 } ( )
644634}
0 commit comments