@@ -45,22 +45,24 @@ def check_no_enhanced_diagnostic(test, frame, var_name):
45
45
46
46
class TestSwiftClosureVarNotCaptured (TestBase ):
47
47
def get_to_bkpt (self , bkpt_name ):
48
- return lldbutil .run_to_source_breakpoint (
48
+ target , process , thread , bkpt = lldbutil .run_to_source_breakpoint (
49
49
self , bkpt_name , lldb .SBFileSpec ("main.swift" )
50
50
)
51
+ target .BreakpointDelete (bkpt .GetID ())
52
+ return (target , process , thread )
51
53
52
54
@swiftTest
53
55
def test_simple_closure (self ):
54
56
self .build ()
55
- (target , process , thread , bkpt ) = self .get_to_bkpt ("break_simple_closure" )
57
+ (target , process , thread ) = self .get_to_bkpt ("break_simple_closure" )
56
58
check_not_captured_error (self , thread .frames [0 ], "var_in_foo" , "func_1(arg:)" )
57
59
check_not_captured_error (self , thread .frames [0 ], "arg" , "func_1(arg:)" )
58
60
check_no_enhanced_diagnostic (self , thread .frames [0 ], "dont_find_me" )
59
61
60
62
@swiftTest
61
63
def test_nested_closure (self ):
62
64
self .build ()
63
- (target , process , thread , bkpt ) = self .get_to_bkpt ("break_double_closure_1" )
65
+ (target , process , thread ) = self .get_to_bkpt ("break_double_closure_1" )
64
66
check_not_captured_error (self , thread .frames [0 ], "var_in_foo" , "func_2(arg:)" )
65
67
check_not_captured_error (self , thread .frames [0 ], "arg" , "func_2(arg:)" )
66
68
check_not_captured_error (
@@ -86,7 +88,7 @@ def test_nested_closure(self):
86
88
@skipIf (oslist = ["windows" , "linux" ])
87
89
def test_async_closure (self ):
88
90
self .build ()
89
- (target , process , thread , bkpt ) = self .get_to_bkpt ("break_async_closure_1" )
91
+ (target , process , thread ) = self .get_to_bkpt ("break_async_closure_1" )
90
92
check_not_captured_error (self , thread .frames [0 ], "var_in_foo" , "func_3(arg:)" )
91
93
check_not_captured_error (self , thread .frames [0 ], "arg" , "func_3(arg:)" )
92
94
check_not_captured_error (
@@ -107,7 +109,28 @@ def test_async_closure(self):
107
109
@swiftTest
108
110
def test_ctor_class_closure (self ):
109
111
self .build ()
110
- (target , process , thread , bkpt ) = self .get_to_bkpt ("break_ctor_class" )
111
- check_not_captured_error (self , thread .frames [0 ], "input" , "MY_STRUCT.init(input:)" )
112
- check_not_captured_error (self , thread .frames [0 ], "find_me" , "MY_STRUCT.init(input:)" )
112
+ (target , process , thread ) = self .get_to_bkpt ("break_ctor_class" )
113
+ check_not_captured_error (
114
+ self , thread .frames [0 ], "input" , "MY_STRUCT.init(input:)"
115
+ )
116
+ check_not_captured_error (
117
+ self , thread .frames [0 ], "find_me" , "MY_STRUCT.init(input:)"
118
+ )
113
119
check_no_enhanced_diagnostic (self , thread .frames [0 ], "dont_find_me" )
120
+
121
+ lldbutil .continue_to_source_breakpoint (
122
+ self , process , "break_static_member" , lldb .SBFileSpec ("main.swift" )
123
+ )
124
+ check_not_captured_error (
125
+ self ,
126
+ thread .frames [0 ],
127
+ "input_static" ,
128
+ "static MY_STRUCT.static_func(input_static:)" ,
129
+ )
130
+ check_not_captured_error (
131
+ self ,
132
+ thread .frames [0 ],
133
+ "find_me_static" ,
134
+ "static MY_STRUCT.static_func(input_static:)" ,
135
+ )
136
+ check_no_enhanced_diagnostic (self , thread .frames [0 ], "dont_find_me_static" )
0 commit comments