Skip to content

Commit 6df9e55

Browse files
committed
Add TestTaskGroupSynthetic.py
1 parent 94057a1 commit 6df9e55

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SWIFT_SOURCES := main.swift
2+
SWIFTFLAGS_EXTRAS := -parse-as-library
3+
include Makefile.rules
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import lldb
2+
from lldbsuite.test.decorators import *
3+
from lldbsuite.test.lldbtest import *
4+
from lldbsuite.test import lldbutil
5+
6+
7+
class TestCase(TestBase):
8+
9+
@swiftTest
10+
def test(self):
11+
"""Print a TaskGroup and verify its children."""
12+
self.build()
13+
lldbutil.run_to_source_breakpoint(
14+
self, "break here", lldb.SBFileSpec("main.swift")
15+
)
16+
self.expect(
17+
"v group",
18+
substrs=[
19+
"[0] = {",
20+
"isGroupChildTask = true",
21+
"[1] = {",
22+
"isGroupChildTask = true",
23+
"[2] = {",
24+
"isGroupChildTask = true",
25+
],
26+
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@main struct Main {
2+
static func main() async {
3+
await withTaskGroup { group in
4+
for _ in 0..<3 {
5+
group.addTask {
6+
try? await Task.sleep(for: .seconds(300))
7+
}
8+
}
9+
10+
print("break here")
11+
for await _ in group {}
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)