]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/test_python_traceback.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / test_python_traceback.vader
diff --git a/.vim/bundle/ale/test/test_python_traceback.vader b/.vim/bundle/ale/test/test_python_traceback.vader
new file mode 100644 (file)
index 0000000..6a65998
--- /dev/null
@@ -0,0 +1,79 @@
+Execute(ale#python#HandleTraceback returns empty List for empty lines):
+  AssertEqual
+  \  [],
+  \  ale#python#HandleTraceback([], 10)
+
+Execute(ale#python#HandleTraceback returns traceback, when present):
+  AssertEqual
+  \  [{
+  \    'lnum': 1,
+  \    'text': 'Exception: Example error (See :ALEDetail)',
+  \    'detail': join([
+  \      'Traceback (most recent call last):',
+  \      '  File "./example.py", line 5, in <module>',
+  \      '    raise Exception(''Example message'')',
+  \      'Exception: Example error',
+  \    ], "\n"),
+  \  }],
+  \  ale#python#HandleTraceback([
+  \    'Traceback (most recent call last):',
+  \    '  File "./example.py", line 5, in <module>',
+  \    '    raise Exception(''Example message'')',
+  \    'Exception: Example error',
+  \  ], 1)
+
+" SyntaxError has extra output lines about the source
+Execute(ale#python#HandleTraceback returns SyntaxError traceback):
+  AssertEqual
+  \  [{
+  \    'lnum': 1,
+  \    'text': 'SyntaxError: invalid syntax (See :ALEDetail)',
+  \    'detail': join([
+  \      'Traceback (most recent call last):',
+  \      '  File "<string>", line 1, in <module>',
+  \      '  File "example.py", line 5',
+  \      '    +',
+  \      '    ^',
+  \      'SyntaxError: invalid syntax',
+  \    ], "\n"),
+  \  }],
+  \  ale#python#HandleTraceback([
+  \    'Traceback (most recent call last):',
+  \    '  File "<string>", line 1, in <module>',
+  \    '  File "example.py", line 5',
+  \    '    +',
+  \    '    ^',
+  \    'SyntaxError: invalid syntax',
+  \  ], 1)
+
+Execute(ale#python#HandleTraceback ignores traceback after line limit):
+  AssertEqual
+  \  [],
+  \  ale#python#HandleTraceback([
+  \    '',
+  \    'Traceback (most recent call last):',
+  \    '  File "./example.py", line 5, in <module>',
+  \    '    raise Exception(''Example message'')',
+  \    'Exception: Example error',
+  \  ], 1)
+
+Execute(ale#python#HandleTraceback doesn't include later lines in detail):
+  AssertEqual
+  \  [{
+  \    'lnum': 1,
+  \    'text': 'Exception: Example error (See :ALEDetail)',
+  \    'detail': join([
+  \      'Traceback (most recent call last):',
+  \      '  File "./example.py", line 5, in <module>',
+  \      '    raise Exception(''Example message'')',
+  \      'Exception: Example error',
+  \    ], "\n"),
+  \  }],
+  \  ale#python#HandleTraceback([
+  \    'Traceback (most recent call last):',
+  \    '  File "./example.py", line 5, in <module>',
+  \    '    raise Exception(''Example message'')',
+  \    'Exception: Example error',
+  \    'file:1:2: Style issue',
+  \    'file:3:4: Non-style issue',
+  \  ], 1)