forked from OSchip/llvm-project
[lldb] Modernize TestVLA.py
Use expect_expr/var_path instead of regular expect and substring checks
This commit is contained in:
parent
e1acadb61d
commit
560221ac7f
|
@ -32,14 +32,19 @@ class TestVLA(TestBase):
|
||||||
_, process, _, _ = lldbutil.run_to_source_breakpoint(
|
_, process, _, _ = lldbutil.run_to_source_breakpoint(
|
||||||
self, "break here", lldb.SBFileSpec('main.c'))
|
self, "break here", lldb.SBFileSpec('main.c'))
|
||||||
|
|
||||||
def test(a, array):
|
def test(a):
|
||||||
|
children = []
|
||||||
for i in range(a):
|
for i in range(a):
|
||||||
self.expect("fr v vla[%d]"%i, substrs=["int", "%d"%(a-i)])
|
name = "[%d]"%i
|
||||||
self.expect("expr vla[%d]"%i, substrs=["int", "%d"%(a-i)])
|
value = str(a-i)
|
||||||
self.expect("fr v vla", substrs=array)
|
self.expect_var_path("vla"+name, type="int", value=value)
|
||||||
|
self.expect_expr("vla"+name, result_type="int",
|
||||||
|
result_value=value)
|
||||||
|
children.append(ValueCheck(name=name, value=value))
|
||||||
|
self.expect_var_path("vla", type="int[]", children=children)
|
||||||
self.expect("expr vla", error=True, substrs=["incomplete"])
|
self.expect("expr vla", error=True, substrs=["incomplete"])
|
||||||
|
|
||||||
test(2, ["int[]", "[0] = 2, [1] = 1"])
|
test(2)
|
||||||
process.Continue()
|
process.Continue()
|
||||||
test(4, ["int[]", "[0] = 4, [1] = 3, [2] = 2, [3] = 1"])
|
test(4)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue