2 Tests that frame variable and expr work for
3 C++ unions and their static data members.
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"""
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"])
27 result_children
=[ValueCheck(name
="val", value
="42")],
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"""
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")
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
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")
67 result_children
=[ValueCheck(name
="val", value
="137")],