Files
swift-mirror/test/refactoring/ExtractFunction/await.swift
Daniel Rodríguez Troitiño e60785e1ef [test] Mark some tests as requiring Swift Syntax (#70493)
Some of the tests now depend on features provided by Swift Syntax, and
will fail to pass if building without Swift Syntax support.

This commits marks all the tests I know fail to pass when Swift Syntax
is disabled.

- #70281 modified `ASTGen/verify-parse.swift`
- #70287 created `refactoring/SyntacticRename/operator.swift` and `SourceKit/RelatedIdents/operator.swift`
- #70389 modified `SourceKit/Refactoring/basic.swift` and indirectly
  modified all `refactoring/ExtractFunction/*` tests.
2023-12-15 13:33:14 -08:00

20 lines
1.0 KiB
Swift

func longLongLongJourney() async -> Int { 0 }
func longLongLongAwryJourney() async throws -> Int { 0 }
func consumesAsync(_ fn: () async throws -> Void) rethrows {}
func testThrowingClosure() async throws -> Int {
let x = await longLongLongJourney()
let y = try await longLongLongAwryJourney() + 1
try consumesAsync { try await longLongLongAwryJourney() }
return x + y
}
// RUN: %empty-directory(%t.result)
// RUN: %refactor -extract-function -source-filename %s -pos=6:11 -end-pos=6:38 >> %t.result/async1.swift
// RUN: diff -u %S/Outputs/await/async1.swift.expected %t.result/async1.swift
// RUN: %refactor -extract-function -source-filename %s -pos=7:11 -end-pos=7:50 >> %t.result/async2.swift
// RUN: diff -u %S/Outputs/await/async2.swift.expected %t.result/async2.swift
// RUN: %refactor -extract-function -source-filename %s -pos=8:1 -end-pos=8:60 >> %t.result/consumes_async.swift
// RUN: diff -u %S/Outputs/await/consumes_async.swift.expected %t.result/consumes_async.swift
// REQUIRES: swift_swift_parser