xref: /llvm-project/lldb/test/API/lang/cpp/operator-overload/TestOperatorOverload.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1import lldb
2from lldbsuite.test.decorators import *
3from lldbsuite.test.lldbtest import *
4from lldbsuite.test import lldbutil
5
6
7class TestOperatorOverload(TestBase):
8    def test_overload(self):
9        self.build()
10        (target, process, thread, main_breakpoint) = lldbutil.run_to_source_breakpoint(
11            self, "break here", lldb.SBFileSpec("b.cpp")
12        )
13        frame = thread.GetSelectedFrame()
14        value = frame.EvaluateExpression("x == nil")
15        self.assertFalse(value.GetError().Success())
16        self.assertIn(
17            "comparison between NULL and non-pointer ('Tinky' and NULL)",
18            str(value.GetError()),
19        )
20        self.assertIn(
21            "invalid operands to binary expression ('Tinky' and", str(value.GetError())
22        )
23