xref: /llvm-project/lldb/test/API/commands/expression/import-std-module/pair/TestPairFromStdModule.py (revision c00032321a6ae26f9c8056d024e262abf342631e)
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
12    mydir = TestBase.compute_mydir(__file__)
13
14    @add_test_categories(["libc++"])
15    @skipIf(compiler=no_match("clang"))
16    # FIXME: This regressed in 69d5a6662115499198ebfa07a081e98a6ce4b915
17    # but needs further investigation for what underlying Clang/LLDB bug can't
18    # handle that code change.
19    @skipIf
20    def test(self):
21        self.build()
22
23        lldbutil.run_to_source_breakpoint(self,
24                                          "// Set break point at this line.",
25                                          lldb.SBFileSpec("main.cpp"))
26
27        self.runCmd("settings set target.import-std-module true")
28
29        self.expect_expr("pair_int.first",
30                         result_type="int",
31                         result_value="1234")
32        self.expect_expr("pair_int.second",
33                         result_type="int",
34                         result_value="5678")
35        self.expect_expr("pair_int",
36                         result_type="std::pair<int, int>",
37                         result_children=[
38                             ValueCheck(name="first", value="1234"),
39                             ValueCheck(name="second", value="5678"),
40                         ])
41        self.expect_expr(
42            "std::pair<long, long> lp; lp.first = 3333; lp.second = 2344; lp",
43            result_type="std::pair<long, long>",
44            result_children=[
45                ValueCheck(name="first", value="3333"),
46                ValueCheck(name="second", value="2344"),
47            ])
48