1"""
2Test lldb data formatter subsystem.
3"""
4
5
6
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class TestDataFormatterLibcxxTuple(TestBase):
14
15    def setUp(self):
16        TestBase.setUp(self)
17        self.line = line_number('main.cpp', '// break here')
18        self.namespace = 'std'
19
20    @add_test_categories(["libc++"])
21    def test(self):
22        """Test that std::tuple is displayed correctly"""
23        self.build()
24        lldbutil.run_to_source_breakpoint(self, '// break here',
25                lldb.SBFileSpec("main.cpp", False))
26
27        tuple_name = self.namespace + '::tuple'
28        self.expect("frame variable empty",
29                    substrs=[tuple_name,
30                             'size=0',
31                             '{}'])
32
33        self.expect("frame variable one_elt",
34                    substrs=[tuple_name,
35                             'size=1',
36                             '{',
37                             '[0] = 47',
38                             '}'])
39
40        self.expect("frame variable three_elts",
41                    substrs=[tuple_name,
42                             'size=3',
43                             '{',
44                             '[0] = 1',
45                             '[1] = 47',
46                             '[2] = "foo"',
47                             '}'])
48