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