74 lines · python
1"""2Test calling an expression with errors that a FixIt can fix.3"""4 5import lldb6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test import lldbutil9 10 11class NestedExpressions(TestBase):12 def test_enum_in_nested_structs(self):13 """14 Test expressions that references an enumeration in nested structs.15 """16 self.build()17 exe_path = self.getBuildArtifact("a.out")18 target = self.dbg.CreateTarget(exe_path)19 self.assertTrue(target, "Target: %s is not valid." % (exe_path))20 self.expect_expr(21 "A::B::C::EnumType::Eleven",22 result_type="A::B::C::EnumType",23 result_value="Eleven",24 )25 26 def test_struct_in_nested_structs(self):27 """28 Test expressions that references a struct in nested structs.29 """30 self.build()31 exe_path = self.getBuildArtifact("a.out")32 target = self.dbg.CreateTarget(exe_path)33 self.assertTrue(target, "Target: %s is not valid." % (exe_path))34 self.expect_expr("sizeof(A::B::C)", result_value="1")35 self.expect_expr("sizeof(A::B)", result_value="2")36 37 # Fails on Windows for unknown reasons.38 @skipIfWindows39 def test_static_in_nested_structs(self):40 """41 Test expressions that references a static variable in nested structs.42 """43 self.build()44 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(45 self, "Stop here to evaluate expressions", lldb.SBFileSpec("main.cpp")46 )47 self.expect_expr(48 "A::B::C::enum_static",49 result_type="A::B::C::EnumType",50 result_value="Eleven",51 )52 53 def test_enum_in_nested_namespaces(self):54 """55 Test expressions that references an enumeration in nested namespaces.56 """57 self.build()58 exe_path = self.getBuildArtifact("a.out")59 target = self.dbg.CreateTarget(exe_path)60 self.assertTrue(target, "Target: %s is not valid." % (exe_path))61 self.expect_expr(62 "a::b::c::Color::Blue", result_type="a::b::c::Color", result_value="Blue"63 )64 65 def test_static_in_nested_namespaces(self):66 """67 Test expressions that references an enumeration in nested namespaces.68 """69 self.build()70 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(71 self, "Stop here to evaluate expressions", lldb.SBFileSpec("main.cpp")72 )73 self.expect_expr("a::b::c::d", result_type="int", result_value="12")74