def test_get_length(self): SRC = SourceString('hello world') assert SRC.get_length(5) == 'hello' assert SRC.get_length(11) == 'hello world' assert SRC.get_length(12) == '' assert SRC.get_length(12, True) == 'hello world'
def test_eat_string_multiline_peices(self): SRC = SourceString('hello\nworld') SRC.eat_string(SRC.get_length(5)) assert SRC.row == 1 assert SRC.col == 5 assert SRC.get_char() == '\n' SRC.eat_string(SRC.get_char()) assert SRC.row == 2 assert SRC.col == 0 SRC.eat_string(SRC.get_length(5)) assert SRC.row == 2 assert SRC.col == 5 assert SRC.get_char() == ''