File tree Expand file tree Collapse file tree 4 files changed +41
-5
lines changed
feature_tests/subtools/test Expand file tree Collapse file tree 4 files changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -205,14 +205,17 @@ large test cases that would normally take much longer to complete.
205
205
206
206
----
207
207
## DexLabel
208
- DexLabel(name)
208
+ DexLabel(name [, **on_line] )
209
209
210
210
Args:
211
211
name (str): A unique name for this line.
212
212
213
+ Keyword args:
214
+ on_line (int): Specify a line number to label.
215
+
213
216
### Description
214
- Name the line this command is found on. Line names can be referenced by other
215
- commands expecting line number arguments.
217
+ Name the line this command is found on or 'on_line' if it is provided. Line
218
+ names can be referenced by other commands expecting line number arguments.
216
219
For example, ` DexExpectWatchValues(..., on_line='my_line_name') ` .
217
220
218
221
### Heuristic
Original file line number Diff line number Diff line change 12
12
13
13
14
14
class DexLabel (CommandBase ):
15
- def __init__ (self , label ):
15
+ def __init__ (self , label , ** kwargs ):
16
16
17
17
if not isinstance (label , str ):
18
18
raise TypeError ('invalid argument type' )
19
19
20
+ try :
21
+ self .on_line = kwargs .pop ('on_line' )
22
+ except KeyError :
23
+ # We cannot use self.lineno because it hasn't been set yet.
24
+ pass
25
+ if kwargs :
26
+ raise TypeError (f'unexpected named args: { ", " .join (kwargs )} ' )
27
+
20
28
self ._label = label
21
29
super (DexLabel , self ).__init__ ()
22
30
31
+ def get_line (self ):
32
+ return getattr (self , 'on_line' , self .lineno )
33
+
23
34
def get_as_pair (self ):
24
- return (self ._label , self .lineno )
35
+ return (self ._label , self .get_line () )
25
36
26
37
@staticmethod
27
38
def get_name ():
Original file line number Diff line number Diff line change
1
+ // Purpose:
2
+ // Check that bad keyword args in \DexLabel are reported.
3
+ // Use --binary switch to trick dexter into skipping the build step.
4
+ //
5
+ // RUN: not %dexter_base test --binary %s --debugger 'lldb' -- %s | FileCheck %s
6
+ // CHECK: parser error:{{.*}}err_label_kwarg.cpp(8): unexpected named args: bad_arg
7
+
8
+ // DexLabel('test', bad_arg=0)
Original file line number Diff line number Diff line change
1
+ // Purpose:
2
+ // Check that the optional keyword argument 'on_line' makes a \DexLabel label
3
+ // that line instead of the line the command is found on.
4
+ //
5
+ // RUN: %dexter_regression_test -- %s | FileCheck %s
6
+ // CHECK: label_another_line.cpp: (1.0000)
7
+
8
+ int main () {
9
+ int result = 0 ;
10
+ return result;
11
+ }
12
+
13
+ // DexLabel('test', on_line=10)
14
+ // DexExpectWatchValue('result', '0', on_line='test')
You can’t perform that action at this time.
0 commit comments