xref: /llvm-project/lldb/test/API/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""Test that inline functions from modules are imported correctly"""
2
3
4import lldb
5from lldbsuite.test.decorators import *
6from lldbsuite.test.lldbtest import *
7from lldbsuite.test import lldbutil
8
9
10class ModulesInlineFunctionsTestCase(TestBase):
11    @add_test_categories(["gmodules"])
12    @skipIf(macos_version=["<", "10.12"])
13    def test_expr(self):
14        self.build()
15        exe = self.getBuildArtifact("a.out")
16        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
17
18        # Break inside the foo function which takes a bar_ptr argument.
19        lldbutil.run_to_source_breakpoint(
20            self, "// Set breakpoint here.", lldb.SBFileSpec("main.m")
21        )
22
23        self.runCmd(
24            'settings set target.clang-module-search-paths "'
25            + self.getSourceDir()
26            + '"'
27        )
28
29        self.expect(
30            "expr @import myModule; 3",
31            VARIABLES_DISPLAYED_CORRECTLY,
32            substrs=["int", "3"],
33        )
34
35        self.expect("expr isInline(2)", VARIABLES_DISPLAYED_CORRECTLY, substrs=["4"])
36