xref: /llvm-project/lldb/test/API/lang/cpp/nested-template/TestNestedTemplate.py (revision 7e00e3ae6dd4ba215dad27d1729df533cbb37795)
1"""
2Test that a nested template parameter works with simple template names.
3"""
4
5import lldb
6import lldbsuite.test.lldbutil as lldbutil
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9
10
11class NestedTemplateTestCase(TestBase):
12    def do_test(self, debug_flags):
13        self.build(dictionary=debug_flags)
14        self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
15        self.expect(
16            "image lookup -A -t 'Inner<int>'",
17            DATA_TYPES_DISPLAYED_CORRECTLY,
18            substrs=["1 match found"],
19        )
20        self.expect(
21            "image lookup -A -t 'NS::Struct<int>'",
22            DATA_TYPES_DISPLAYED_CORRECTLY,
23            substrs=["1 match found"],
24        )
25        self.expect(
26            "image lookup -A -t 'NS::Union<int>'",
27            DATA_TYPES_DISPLAYED_CORRECTLY,
28            substrs=["1 match found"],
29        )
30
31    @skipIf(compiler=no_match("clang"))
32    @skipIf(compiler_version=["<", "15.0"])
33    def test_simple_template_names(self):
34        self.do_test(dict(TEST_CFLAGS_EXTRAS="-gsimple-template-names"))
35
36    @skipIf(compiler=no_match("clang"))
37    @skipIf(compiler_version=["<", "15.0"])
38    def test_no_simple_template_names(self):
39        self.do_test(dict(TEST_CFLAGS_EXTRAS="-gno-simple-template-names"))
40