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
10 class CppUnionStaticMembersTestCase(TestBase
):
11 def test_print_union(self
):
12 """Tests that frame variable and expr work
13 for union with static data members"""
16 (target
, process
, main_thread
, _
) = lldbutil
.run_to_source_breakpoint(
17 self
, "return 0", lldb
.SBFileSpec("main.cpp")
20 self
.expect("frame variable foo", substrs
=["val = 42"])
21 self
.expect("frame variable bar", substrs
=["val = 137"])
23 self
.expect_expr("foo", result_type
="Foo", result_children
=[ValueCheck(
24 name
="val", value
="42"
26 self
.expect_expr("bar", result_type
="Bar", result_children
=[ValueCheck(
27 name
="val", value
="137"
30 @expectedFailureWindows
31 def test_expr_union_static_members(self
):
32 """Tests that frame variable and expr work
33 for union static data members"""
36 (target
, process
, main_thread
, _
) = lldbutil
.run_to_source_breakpoint(
37 self
, "return 0", lldb
.SBFileSpec("main.cpp")
40 self
.expect_expr("Foo::sVal1", result_type
="const int", result_value
="-42")
41 self
.expect_expr("Foo::sVal2", result_type
="Foo", result_children
=[ValueCheck(
42 name
="val", value
="42"
46 def test_union_in_anon_namespace(self
):
47 """Tests that frame variable and expr work
48 for union static data members in anonymous
52 (target
, process
, main_thread
, _
) = lldbutil
.run_to_source_breakpoint(
53 self
, "return 0", lldb
.SBFileSpec("main.cpp")
56 self
.expect_expr("Bar::sVal1", result_type
="const int", result_value
="-137")
57 self
.expect_expr("Bar::sVal2", result_type
="Bar", result_children
=[ValueCheck(
58 name
="val", value
="137"