summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-05-22 12:59:40 +0100
committerw0rp <devw0rp@gmail.com>2017-05-22 12:59:40 +0100
commit1e72a7a130c51f02b5910e982267f17e8c4880d6 (patch)
tree20d1caab9dd12128b72806ff8a8f65e26f27766f /test
parent4526018344b26c82b5969d837630f4ee7785d629 (diff)
downloadale-1e72a7a130c51f02b5910e982267f17e8c4880d6.zip
Add a fixer for Python for automatically adding blank lines before control statements
Diffstat (limited to 'test')
-rw-r--r--test/fixers/test_python_add_blank_lines_fixer.vader85
1 files changed, 85 insertions, 0 deletions
diff --git a/test/fixers/test_python_add_blank_lines_fixer.vader b/test/fixers/test_python_add_blank_lines_fixer.vader
new file mode 100644
index 00000000..6a3c58da
--- /dev/null
+++ b/test/fixers/test_python_add_blank_lines_fixer.vader
@@ -0,0 +1,85 @@
+Before:
+ Save g:ale_fixers
+
+After:
+ Restore
+
+Given python(Some Python without blank lines):
+ def foo():
+ return 1
+
+
+ def bar():
+ return 1
+ return 4
+
+
+ def bar():
+ if x:
+ pass
+ for l in x:
+ pass
+ for l in x:
+ pass
+ break
+ continue
+ elif x:
+ pass
+ while x:
+ pass
+ while x:
+ pass
+ else:
+ pass
+ if x:
+ pass
+ elif x:
+ pass
+ else:
+ pass
+
+Execute(Blank lines should be added appropriately):
+ let g:ale_fixers = {'python': ['ale#handlers#python#AddLinesBeforeControlStatements']}
+ ALEFix
+
+Expect python(Newlines should be added):
+ def foo():
+ return 1
+
+
+ def bar():
+ return 1
+
+ return 4
+
+
+ def bar():
+ if x:
+ pass
+
+ for l in x:
+ pass
+
+ for l in x:
+ pass
+
+ break
+
+ continue
+ elif x:
+ pass
+
+ while x:
+ pass
+
+ while x:
+ pass
+ else:
+ pass
+
+ if x:
+ pass
+ elif x:
+ pass
+ else:
+ pass