brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · d02dfe6 Raw
42 lines · python
1from lldbsuite.test.lldbinline import CommandParser2from lldbsuite.test.lldbtest import Base3import textwrap4 5 6class TestCommandParser(Base):7    def test_indentation(self):8        """Test indentation handling"""9        filename = self.getBuildArtifact("test_file.cpp")10        with open(filename, "w") as f:11            f.write(12                textwrap.dedent(13                    """\14                    int q;15                    int w; //% first break16                    int e;17                    int r; //% second break18                    //% continue second19                    //%   continuing indented20                      //% not indented21                    int t; //% third break22                    """23                )24            )25        p = CommandParser()26        p.parse_source_files([filename])27 28        def bkpt(line, cmd):29            return {"file_name": filename, "line_number": line, "command": cmd}30 31        self.assertEqual(32            p.breakpoints,33            [34                bkpt(2, "first break"),35                bkpt(36                    4,37                    "second break\ncontinue second\n  continuing indented\nnot indented",38                ),39                bkpt(8, "third break"),40            ],41        )42