test for carriage return issues. fast parser seems to be counting characters wrong when carriage returns are involved. see #402

This commit is contained in:
Dave Halter
2014-05-04 01:56:53 +02:00
parent 065e9a001d
commit 091518d924

View File

@@ -1,4 +1,8 @@
from textwrap import dedent
import jedi
from jedi.parser.fast import FastParser
def test_add_to_end():
"""
@@ -35,3 +39,18 @@ def test_class_in_docstr():
b = a + '\nimport os'
assert jedi.Script(b, 4, 8).goto_assignments()
def test_carriage_return_splitting():
source = dedent('''
"string"
class Foo():
pass
''')
source = source.replace('\n', '\r\n')
p = FastParser(source)
assert [str(n) for n in p.module.get_defined_names()] == ['Foo']