xref: /llvm-project/lldb/test/API/commands/expression/import-std-module/pair/TestPairFromStdModule.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""
2Test basic std::pair functionality.
3"""
4
5from lldbsuite.test.decorators import *
6from lldbsuite.test.lldbtest import *
7from lldbsuite.test import lldbutil
8
9
10class TestCase(TestBase):
11    @add_test_categories(["libc++"])
12    @skipIf(compiler=no_match("clang"))
13    # FIXME: This regressed in 69d5a6662115499198ebfa07a081e98a6ce4b915
14    # but needs further investigation for what underlying Clang/LLDB bug can't
15    # handle that code change.
16    @skipIf
17    def test(self):
18        self.build()
19
20        lldbutil.run_to_source_breakpoint(
21            self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")
22        )
23
24        self.runCmd("settings set target.import-std-module true")
25
26        self.expect_expr("pair_int.first", result_type="int", result_value="1234")
27        self.expect_expr("pair_int.second", result_type="int", result_value="5678")
28        self.expect_expr(
29            "pair_int",
30            result_type="std::pair<int, int>",
31            result_children=[
32                ValueCheck(name="first", value="1234"),
33                ValueCheck(name="second", value="5678"),
34            ],
35        )
36        self.expect_expr(
37            "std::pair<long, long> lp; lp.first = 3333; lp.second = 2344; lp",
38            result_type="std::pair<long, long>",
39            result_children=[
40                ValueCheck(name="first", value="3333"),
41                ValueCheck(name="second", value="2344"),
42            ],
43        )
44