From 091518d924cd00411f5e704890cc4ce815f24be4 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 4 May 2014 01:56:53 +0200 Subject: [PATCH] test for carriage return issues. fast parser seems to be counting characters wrong when carriage returns are involved. see #402 --- test/test_parser/test_fast_parser.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/test_parser/test_fast_parser.py b/test/test_parser/test_fast_parser.py index 9059e818..8c45cf50 100644 --- a/test/test_parser/test_fast_parser.py +++ b/test/test_parser/test_fast_parser.py @@ -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']