Skip to content

Commit 560221a

Browse files
committed
[lldb] Modernize TestVLA.py
Use expect_expr/var_path instead of regular expect and substring checks
1 parent e1acadb commit 560221a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lldb/test/API/lang/c/vla/TestVLA.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,19 @@ def test_vla(self):
3232
_, process, _, _ = lldbutil.run_to_source_breakpoint(
3333
self, "break here", lldb.SBFileSpec('main.c'))
3434

35-
def test(a, array):
35+
def test(a):
36+
children = []
3637
for i in range(a):
37-
self.expect("fr v vla[%d]"%i, substrs=["int", "%d"%(a-i)])
38-
self.expect("expr vla[%d]"%i, substrs=["int", "%d"%(a-i)])
39-
self.expect("fr v vla", substrs=array)
38+
name = "[%d]"%i
39+
value = str(a-i)
40+
self.expect_var_path("vla"+name, type="int", value=value)
41+
self.expect_expr("vla"+name, result_type="int",
42+
result_value=value)
43+
children.append(ValueCheck(name=name, value=value))
44+
self.expect_var_path("vla", type="int[]", children=children)
4045
self.expect("expr vla", error=True, substrs=["incomplete"])
4146

42-
test(2, ["int[]", "[0] = 2, [1] = 1"])
47+
test(2)
4348
process.Continue()
44-
test(4, ["int[]", "[0] = 4, [1] = 3, [2] = 2, [3] = 1"])
49+
test(4)
4550

0 commit comments

Comments
 (0)