1*349295fcSPavel Labathfrom lldbsuite.test.lldbinline import CommandParser 2*349295fcSPavel Labathfrom lldbsuite.test.lldbtest import Base 3*349295fcSPavel Labathimport textwrap 4*349295fcSPavel Labath 5*349295fcSPavel Labath 6*349295fcSPavel Labathclass TestCommandParser(Base): 7*349295fcSPavel Labath 8*349295fcSPavel Labath def test_indentation(self): 9*349295fcSPavel Labath """Test indentation handling""" 10*349295fcSPavel Labath filename = self.getBuildArtifact("test_file.cpp") 11*349295fcSPavel Labath with open(filename, "w") as f: 12*349295fcSPavel Labath f.write(textwrap.dedent("""\ 13*349295fcSPavel Labath int q; 14*349295fcSPavel Labath int w; //% first break 15*349295fcSPavel Labath int e; 16*349295fcSPavel Labath int r; //% second break 17*349295fcSPavel Labath //% continue second 18*349295fcSPavel Labath //% continuing indented 19*349295fcSPavel Labath //% not indented 20*349295fcSPavel Labath int t; //% third break 21*349295fcSPavel Labath """)) 22*349295fcSPavel Labath p = CommandParser() 23*349295fcSPavel Labath p.parse_source_files([filename]) 24*349295fcSPavel Labath 25*349295fcSPavel Labath def bkpt(line, cmd): 26*349295fcSPavel Labath return {'file_name': filename, 'line_number': line, 'command': cmd} 27*349295fcSPavel Labath self.assertEqual( 28*349295fcSPavel Labath p.breakpoints, [ 29*349295fcSPavel Labath bkpt(2, 'first break'), 30*349295fcSPavel Labath bkpt(4, 'second break\ncontinue second\n continuing indented\nnot indented'), 31*349295fcSPavel Labath bkpt(8, "third break")]) 32