xref: /llvm-project/lldb/test/API/commands/expression/inline-namespace/TestInlineNamespace.py (revision 99451b4453688a94c6014cac233d371ab4cc342d)
1"""
2Test that we correctly handle inline namespaces.
3"""
4
5import lldb
6
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9from lldbsuite.test import lldbutil
10
11
12class TestInlineNamespace(TestBase):
13    mydir = TestBase.compute_mydir(__file__)
14
15    def test(self):
16        self.build()
17
18        lldbutil.run_to_source_breakpoint(self,
19            "// Set break point at this line.", lldb.SBFileSpec("main.cpp"))
20
21        # The 'A::B::f' function must be found via 'A::f' as 'B' is an inline
22        # namespace.
23        self.expect_expr("A::f()", result_type="int", result_value="3")
24        # But we should still find the function when we pretend the inline
25        # namespace is not inline.
26        self.expect_expr("A::B::f()", result_type="int", result_value="3")
27