xref: /llvm-project/lldb/test/API/lang/objc/warnings-in-expr-parser/TestObjCWarningsInExprParser.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""
2Test the warnings that LLDB emits when parsing Objective-C expressions.
3"""
4
5import lldb
6from lldbsuite.test.decorators import *
7from lldbsuite.test.lldbtest import *
8from lldbsuite.test import lldbutil
9
10
11class TestCase(TestBase):
12    @skipUnlessDarwin
13    @no_debug_info_test
14    def test(self):
15        self.build()
16        lldbutil.run_to_source_breakpoint(
17            self, "// break here", lldb.SBFileSpec("main.m")
18        )
19
20        # Don't warn about not using the result of getters. This is perfectly
21        # fine in the expression parser and LLDB shouldn't warn the user about that.
22        result = self.frame().EvaluateExpression("m.m; unknown_var_to_cause_an_error")
23        self.assertNotIn("getters should not", str(result.GetError()))
24