File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed
lldb/test/API/lang/swift/async/taskgroups Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ SWIFT_SOURCES := main.swift
2
+ SWIFTFLAGS_EXTRAS := -parse-as-library
3
+ include Makefile.rules
Original file line number Diff line number Diff line change
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
+ )
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments