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