@@ -45,7 +45,7 @@ def test_swift_move_function(self):
45
45
self .process = self .target .LaunchSimple (None , None , os .getcwd ())
46
46
threads = lldbutil .get_threads_stopped_at_breakpoint (
47
47
self .process , self .breakpoints [0 ])
48
- self .assertTrue (len (threads ) == 1 )
48
+ self .assertEqual (len (threads ), 1 )
49
49
self .thread = threads [0 ]
50
50
51
51
self .do_check_copyable_value_test ()
@@ -68,7 +68,7 @@ def add_breakpoints(self, name, num_breakpoints):
68
68
pat = pattern .format (name , i + 1 )
69
69
brk = self .target .BreakpointCreateBySourceRegex (
70
70
pat , self .main_source_spec )
71
- self .assertTrue (brk .GetNumLocations () > 0 , VALID_BREAKPOINT )
71
+ self .assertGreater (brk .GetNumLocations (), 0 , VALID_BREAKPOINT )
72
72
yield brk
73
73
74
74
def do_setup_breakpoints (self ):
@@ -96,15 +96,15 @@ def do_check_copyable_value_test(self):
96
96
# We haven't defined varK yet.
97
97
varK = frame .FindVariable ('k' )
98
98
99
- self .assertTrue (varK .value == None , "varK initialized too early?!" )
99
+ self .assertIsNone (varK .value , "varK initialized too early?!" )
100
100
101
101
# Go to break point 2. k should be valid.
102
102
self .runCmd ('continue' )
103
- self .assertTrue (varK .unsigned > 0 , "varK not initialized?!" )
103
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
104
104
105
105
# Go to breakpoint 3. k should no longer be valid.
106
106
self .runCmd ('continue' )
107
- self .assertTrue (varK .value == None , "K is live but was moved?!" )
107
+ self .assertIsNone (varK .value , "K is live but was moved?!" )
108
108
109
109
# Run so we hit the next breakpoint to jump to the next test's
110
110
# breakpoint.
@@ -116,20 +116,20 @@ def do_check_copyable_var_test(self):
116
116
117
117
# We haven't defined varK yet.
118
118
varK = frame .FindVariable ('k' )
119
- self .assertTrue (varK .value == None , "varK initialized too early?!" )
119
+ self .assertIsNone (varK .value , "varK initialized too early?!" )
120
120
121
121
# Go to break point 2. k should be valid.
122
122
self .runCmd ('continue' )
123
- self .assertTrue (varK .unsigned > 0 , "varK not initialized?!" )
123
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
124
124
125
125
# Go to breakpoint 3. We invalidated k
126
126
self .runCmd ('continue' )
127
- self .assertTrue (varK .value == None , "K is live but was moved?!" )
127
+ self .assertIsNone (varK .value , "K is live but was moved?!" )
128
128
129
129
# Go to the last breakpoint and make sure that k is reinitialized
130
130
# properly.
131
131
self .runCmd ('continue' )
132
- self .assertTrue (varK .unsigned > 0 , "varK not initialized" )
132
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized" )
133
133
134
134
# Run so we hit the next breakpoint to go to the next test.
135
135
self .runCmd ('continue' )
@@ -147,12 +147,11 @@ def do_check_addressonly_value_test(self):
147
147
# move the other variable and show the correct behavior with
148
148
# llvm.dbg.declare.
149
149
self .runCmd ('continue' )
150
-
151
- self .assertTrue (varK .unsigned > 0 , "var not initialized?!" )
150
+ self .assertGreater (varK .unsigned , 0 , "var not initialized?!" )
152
151
153
152
# Go to breakpoint 3.
154
153
self .runCmd ('continue' )
155
- self .assertTrue (varK .unsigned == 0 ,
154
+ self .assertEqual (varK .unsigned , 0 ,
156
155
"dbg thinks varK is live despite move?!" )
157
156
158
157
# Run so we hit the next breakpoint as part of the next test.
@@ -166,16 +165,16 @@ def do_check_addressonly_var_test(self):
166
165
167
166
# Go to break point 2. k should be valid.
168
167
self .runCmd ('continue' )
169
- self .assertTrue (varK .unsigned > 0 , "varK not initialized?!" )
168
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized?!" )
170
169
171
170
# Go to breakpoint 3. K was invalidated.
172
171
self .runCmd ('continue' )
173
- self .assertTrue (varK .value == None , "K is live but was moved?!" )
172
+ self .assertIsNone (varK .value , "K is live but was moved?!" )
174
173
175
174
# Go to the last breakpoint and make sure that k is reinitialized
176
175
# properly.
177
176
self .runCmd ('continue' )
178
- self .assertTrue (varK .unsigned > 0 , "varK not initialized" )
177
+ self .assertGreater (varK .unsigned , 0 , "varK not initialized" )
179
178
180
179
# Run so we hit the next breakpoint as part of the next test.
181
180
self .runCmd ('continue' )
@@ -187,27 +186,26 @@ def do_check_copyable_value_ccf_true(self):
187
186
188
187
# Check at our start point that we do not have any state for varK and
189
188
# then continue to our next breakpoint.
190
- self .assertTrue (varK .value == None , "varK should not have a value?!" )
189
+ self .assertIsNone (varK .value , "varK should not have a value?!" )
191
190
self .runCmd ('continue' )
192
191
193
192
# At this breakpoint, k should be defined since we are going to do
194
193
# something with it.
195
- self .assertTrue (varK .value != None , "varK should have a value?!" )
194
+ self .assertIsNotNone (varK .value , "varK should have a value?!" )
196
195
self .runCmd ('continue' )
197
196
198
197
# At this breakpoint, we are now in the conditional control flow part of
199
198
# the loop. Make sure that we can see k still.
200
- self .assertTrue (varK .value != None , "varK should have a value?!" )
199
+ self .assertIsNotNone (varK .value , "varK should have a value?!" )
201
200
self .runCmd ('continue' )
202
201
203
202
# Ok, we just performed the move. k should not be no longer initialized.
204
- self .runCmd ('fr v' )
205
- self .assertTrue (varK .value == None , "varK should not have a value?!" )
203
+ self .assertIsNone (varK .value , "varK should not have a value?!" )
206
204
self .runCmd ('continue' )
207
205
208
206
# Finally we left the conditional control flow part of the function. k
209
207
# should still be None.
210
- self .assertTrue (varK .value == None , "varK should not have a value!" )
208
+ self .assertIsNone (varK .value , "varK should not have a value!" )
211
209
212
210
def do_check_copyable_value_ccf_false (self ):
213
211
pass
0 commit comments