brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 34b52f7 Raw
45 lines · python
1"""2Tests a C++ fixit for the `expr` command and3`po` alias (aka DWIM aka "do what I mean") alias.4"""5import lldb6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test import lldbutil9 10 11class TestCase(TestBase):12    def test_fixit_with_dwim(self):13        """Confirms `po` shows an expression after applying Fix-It(s)."""14 15        self.build()16        lldbutil.run_to_source_breakpoint(17            self, "// break here", lldb.SBFileSpec("main.cpp")18        )19 20        self.expect(21            "dwim-print -O -- class C { int i; void f() { []() { ++i; }(); } }; 42",22            error=True,23            substrs=[24                "Evaluated this expression after applying Fix-It(s)",25                "class C { int i; void f() { [this]() { ++i; }(); } }",26            ],27        )28 29    def test_fixit_with_expression(self):30        """Confirms `expression` shows an expression after applying Fix-It(s)."""31 32        self.build()33        lldbutil.run_to_source_breakpoint(34            self, "// break here", lldb.SBFileSpec("main.cpp")35        )36 37        self.expect(38            "expr class C { int i; void f() { []() { ++i; }(); } }; 42",39            error=True,40            substrs=[41                "Evaluated this expression after applying Fix-It(s)",42                "class C { int i; void f() { [this]() { ++i; }(); } }",43            ],44        )45