mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
It seems this test not only has issues on Linux but also windows. https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/4488/console Disable for now, until we're able to fix it.
44 lines
803 B
Swift
44 lines
803 B
Swift
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency -parse-as-library) | %FileCheck %s --dump-input=always
|
|
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: concurrency
|
|
// XFAIL: linux
|
|
// XFAIL: windows
|
|
|
|
#if canImport(Darwin)
|
|
import Darwin
|
|
#elseif canImport(Glibc)
|
|
import Glibc
|
|
#endif
|
|
|
|
func test_taskGroup_is_asyncSequence() async {
|
|
let sum: Int = try! await Task.withGroup(resultType: Int.self) { group in
|
|
for n in 1...10 {
|
|
await group.add {
|
|
print("add \(n)")
|
|
return n
|
|
}
|
|
}
|
|
|
|
var sum = 0
|
|
for try await r in group { // here
|
|
print("next: \(r)")
|
|
sum += r
|
|
}
|
|
|
|
return sum
|
|
}
|
|
|
|
// CHECK: result: 55
|
|
print("result: \(sum)")
|
|
}
|
|
|
|
@main struct Main {
|
|
static func main()
|
|
|
|
async {
|
|
await test_taskGroup_is_asyncSequence()
|
|
}
|
|
|
|
}
|