Fix sith.py line number generation

This commit is contained in:
Dave Halter
2019-05-31 11:18:49 +02:00
parent f83c38f5c1
commit 4d647238b3

View File

@@ -111,7 +111,13 @@ class TestCase(object):
if not lines:
lines = ['']
line = random.randint(1, len(lines))
column = random.randint(0, len(lines[line - 1]))
line_string = lines[line - 1]
line_len = len(line_string)
if line_string.endswith('\r\n'):
line_len -= 1
if line_string.endswith('\n'):
line_len -= 1
column = random.randint(0, line_len)
return cls(operation, path, line, column)
def run(self, debugger, record=None, print_result=False):