summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-08-11 10:31:25 +0100
committerw0rp <devw0rp@gmail.com>2017-08-11 10:31:25 +0100
commit78b9ae0f1c65e53eac509b6946f8c70369fab980 (patch)
treebff335f57b7f678f16172d5028a43d84a4c2ad41 /test
parentd5ae3201a4128c9e7b1042e9ea40b7f13cf72a10 (diff)
downloadale-78b9ae0f1c65e53eac509b6946f8c70369fab980.zip
Add a fix function for breaking up long Python lines, which is hidden for now
Diffstat (limited to 'test')
-rw-r--r--test/fixers/long-line-project/setup.cfg2
-rw-r--r--test/fixers/test_break_up_long_lines_python_fixer.vader39
2 files changed, 41 insertions, 0 deletions
diff --git a/test/fixers/long-line-project/setup.cfg b/test/fixers/long-line-project/setup.cfg
new file mode 100644
index 00000000..43d7a3a1
--- /dev/null
+++ b/test/fixers/long-line-project/setup.cfg
@@ -0,0 +1,2 @@
+[flake8]
+max-line-length = 90
diff --git a/test/fixers/test_break_up_long_lines_python_fixer.vader b/test/fixers/test_break_up_long_lines_python_fixer.vader
new file mode 100644
index 00000000..5fd991f0
--- /dev/null
+++ b/test/fixers/test_break_up_long_lines_python_fixer.vader
@@ -0,0 +1,39 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ call ale#test#RestoreDirectory()
+
+Execute(Long lines with basic function calls should be broken up correctly):
+ AssertEqual
+ \ [
+ \ 'def foo():',
+ \ ' some_variable = this_is_a_longer_function(',
+ \ 'first_argument,',
+ \ ' second_argument,',
+ \ ' third_with_function_call(',
+ \ 'foo,',
+ \ ' bar,',
+ \ '))',
+ \ ],
+ \ ale#fixers#generic_python#BreakUpLongLines(bufnr(''), [
+ \ 'def foo():',
+ \ ' some_variable = this_is_a_longer_function(first_argument, second_argument, third_with_function_call(foo, bar))',
+ \ ])
+
+Execute(Longer lines should be permitted if a configuration file allows it):
+ call ale#test#SetFilename('long-line-project/foo/bar.py')
+
+ AssertEqual
+ \ [
+ \ 'x = this_line_is_between_79_and_90_characters(first, second, third, fourth, fifth)',
+ \ 'y = this_line_is_longer_than_90_characters(',
+ \ 'much_longer_word,',
+ \ ' another_longer_word,',
+ \ ' a_third_long_word,',
+ \ ')'
+ \ ],
+ \ ale#fixers#generic_python#BreakUpLongLines(bufnr(''), [
+ \ 'x = this_line_is_between_79_and_90_characters(first, second, third, fourth, fifth)',
+ \ 'y = this_line_is_longer_than_90_characters(much_longer_word, another_longer_word, a_third_long_word)',
+ \ ])