1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6class TestCase(TestBase):
7
8    mydir = TestBase.compute_mydir(__file__)
9
10    @expectedFailureAll(compiler="gcc")
11    def test(self):
12        self.build()
13        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))
14
15        # Test non-type template parameter packs.
16        self.expect_expr("myC", result_type="C<int, 16, 32>", result_children=[
17            ValueCheck(name="C<int, 16>", children=[
18                ValueCheck(name="member", value="64")
19            ])
20        ])
21        self.expect_expr("myLesserC.argsAre_16_32()", result_value="false")
22        self.expect_expr("myC.argsAre_16_32()", result_value="true")
23
24        # Test type template parameter packs.
25        self.expect_expr("myD", result_type="D<int, int, bool>", result_children=[
26            ValueCheck(name="D<int, int>", children=[
27                ValueCheck(name="member", value="64")
28            ])
29        ])
30        self.expect_expr("myLesserD.argsAre_Int_bool()", result_value="false")
31        self.expect_expr("myD.argsAre_Int_bool()", result_value="true")
32
33        # Disabling until we do template lookup correctly: http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html
34        # FIXME: Rewrite this with expect_expr
35        # self.expect("expression -- C<int, 16>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
36        # self.expect("expression -- C<int, 16, 32>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
37        # self.expect("expression -- D<int, int>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
38        # self.expect("expression -- D<int, int, bool>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
39