Skip to content

Commit 6d16899

Browse files
committed
Fix print_elements test
The current implementation of gdb.Value.__str__ doesn't print children, and the test wasn't checking that the prettyprinter yielded any children, so it wasn't really testing anything. Use the `p` command instead from the test as a workaround (so children get printed), and add a positive CHECK to verify that the printer yields as many elements as desired, but not more.
1 parent 791b0bf commit 6d16899

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

test/lit/print_elements.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ still prints the "..." at the end of the children list if it's truncated.
1818
In this case, for 'set print elements 10' we would print children 0-9 and also
1919
yield child 10. So check that we don't yield 11.
2020

21+
CHECK: yielding child 10
2122
CHECK-NOT: yielding child 11

test/lit/print_elements/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def children(self):
2424
size = int(self.val["size"])
2525
i = 0
2626
while i < size:
27-
print("yielding child %d" % i, file=sys.stderr)
27+
print("yielding child %d" % i)
2828
yield "[%d]"%i, i
2929
i += 1
3030

@@ -50,4 +50,4 @@ def __lldb_init_module(debugger, internal_dict):
5050
debugger.HandleCommand('settings set target.max-children-count 10')
5151
print("gdb.parameter('print elements'):", gdb.parameter('print elements'))
5252

53-
print("s = %s" % gdb.parse_and_eval('s'))
53+
debugger.HandleCommand('p s')

0 commit comments

Comments
 (0)