[libc][NFC] Remove extra ; in exhaustive_test.h. (#124216)
[llvm-project.git] / lldb / test / API / lang / cpp / union-static-data-members / TestCppUnionStaticMembers.py
blob2047a8fc4dbdf32a69b13bdaf238e4d3186fddbf
1 """
2 Tests that frame variable and expr work for
3 C++ unions and their static data members.
4 """
5 import lldb
6 from lldbsuite.test.lldbtest import *
7 from lldbsuite.test.decorators import *
8 import lldbsuite.test.lldbutil as lldbutil
11 class CppUnionStaticMembersTestCase(TestBase):
12 def test_print_union(self):
13 """Tests that frame variable and expr work
14 for union with static data members"""
15 self.build()
17 (target, process, main_thread, _) = lldbutil.run_to_source_breakpoint(
18 self, "return 0", lldb.SBFileSpec("main.cpp")
21 self.expect("frame variable foo", substrs=["val = 42"])
22 self.expect("frame variable bar", substrs=["val = 137"])
24 self.expect_expr(
25 "foo",
26 result_type="Foo",
27 result_children=[ValueCheck(name="val", value="42")],
29 self.expect_expr(
30 "bar",
31 result_type="Bar",
32 result_children=[ValueCheck(name="val", value="137")],
35 @expectedFailureWindows
36 def test_expr_union_static_members(self):
37 """Tests that frame variable and expr work
38 for union static data members"""
39 self.build()
41 (target, process, main_thread, _) = lldbutil.run_to_source_breakpoint(
42 self, "return 0", lldb.SBFileSpec("main.cpp")
45 self.expect_expr("Foo::sVal1", result_type="const int", result_value="-42")
46 self.expect_expr(
47 "Foo::sVal2",
48 result_type="Foo",
49 result_children=[ValueCheck(name="val", value="42")],
52 @expectedFailureWindows
53 def test_union_in_anon_namespace(self):
54 """Tests that frame variable and expr work
55 for union static data members in anonymous
56 namespaces"""
57 self.build()
59 (target, process, main_thread, _) = lldbutil.run_to_source_breakpoint(
60 self, "return 0", lldb.SBFileSpec("main.cpp")
63 self.expect_expr("Bar::sVal1", result_type="const int", result_value="-137")
64 self.expect_expr(
65 "Bar::sVal2",
66 result_type="Bar",
67 result_children=[ValueCheck(name="val", value="137")],