xref: /llvm-project/lldb/test/API/lang/objc/modules-compile-error/TestModulesCompileError.py (revision 84fdfb9ca63ee4304b486d7e85545ee4e1a46f5d)
1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6
7class TestCase(TestBase):
8    @skipIf(compiler="clang", compiler_version=["<", "11.0"])
9    def test(self):
10        self.build()
11        lldbutil.run_to_source_breakpoint(
12            self, "// break here", lldb.SBFileSpec("main.m")
13        )
14
15        # Try importing our custom module. This will fail as LLDB won't define
16        # the CLANG_ONLY define when it compiles the module for the expression
17        # evaluator.
18        # Check that the error message shows file/line/column, prints the relevant
19        # line from the source code and mentions the module that failed to build.
20        self.expect(
21            "expr @import LLDBTestModule",
22            error=True,
23            substrs=[
24                "module.h:4:1: error: use of undeclared identifier 'syntax_error_for_lldb_to_find'",
25                "syntax_error_for_lldb_to_find // comment that tests source printing",
26                "could not build module 'LLDBTestModule'",
27            ],
28        )
29