[Object][WebAssembly] Fix data segment offsets higher than 2^31 (#125739)
[llvm-project.git] / lldb / test / API / commands / expression / nested / TestNestedExpressions.py
blob0dabe42f4e74c5d89955dbe6fd788b62a44e712b
1 """
2 Test calling an expression with errors that a FixIt can fix.
3 """
5 import lldb
6 from lldbsuite.test.decorators import *
7 from lldbsuite.test.lldbtest import *
8 from lldbsuite.test import lldbutil
11 class 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",
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")
37 # Fails on Windows for unknown reasons.
38 @skipIfWindows
39 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")
47 self.expect_expr(
48 "A::B::C::enum_static",
49 result_type="A::B::C::EnumType",
50 result_value="Eleven",
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"
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")
73 self.expect_expr("a::b::c::d", result_type="int", result_value="12")