1from lldbsuite.test.lldbinline import CommandParser 2from lldbsuite.test.lldbtest import Base 3import textwrap 4 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 break 16 int e; 17 int r; //% second break 18 //% continue second 19 //% continuing indented 20 //% not indented 21 int t; //% third break 22 """ 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