summaryrefslogtreecommitdiff
path: root/test/fixers
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixers')
-rw-r--r--test/fixers/test_black_fixer_callback.vader8
-rw-r--r--test/fixers/test_dfmt_fixer_callback.vader40
-rw-r--r--test/fixers/test_gnatpp_fixer_callback.vader28
-rw-r--r--test/fixers/test_hindent_fixer_callback.vader18
4 files changed, 94 insertions, 0 deletions
diff --git a/test/fixers/test_black_fixer_callback.vader b/test/fixers/test_black_fixer_callback.vader
index 25ad05db..75864479 100644
--- a/test/fixers/test_black_fixer_callback.vader
+++ b/test/fixers/test_black_fixer_callback.vader
@@ -36,6 +36,14 @@ Execute(The black callback should include options):
\ {'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --some-option -' },
\ ale#fixers#black#Fix(bufnr(''))
+Execute(The black callback should include --pyi for .pyi files):
+ let g:ale_python_black_change_directory = 0
+
+ silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.pyi')
+ AssertEqual
+ \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/black')) . ' --pyi -' },
+ \ ale#fixers#black#Fix(bufnr(''))
+
Execute(Pipenv is detected when python_black_auto_pipenv is set):
let g:ale_python_black_auto_pipenv = 1
let g:ale_python_black_change_directory = 0
diff --git a/test/fixers/test_dfmt_fixer_callback.vader b/test/fixers/test_dfmt_fixer_callback.vader
new file mode 100644
index 00000000..5ecb56e6
--- /dev/null
+++ b/test/fixers/test_dfmt_fixer_callback.vader
@@ -0,0 +1,40 @@
+Before:
+ Save g:ale_d_dfmt_executable
+ Save g:ale_d_dfmt_options
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_d_dfmt_executable = 'xxxinvalid'
+ let g:ale_d_dfmt_options = ''
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The dfmt callback should return the correct default values):
+ call ale#test#SetFilename('../d_files/test.d')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' -i'
+ \ . ' %t',
+ \ },
+ \ ale#fixers#dfmt#Fix(bufnr(''))
+
+Execute(The dfmt callback should include custom dfmt options):
+ let g:ale_d_dfmt_options = "--space-after-cast"
+ call ale#test#SetFilename('../d_files/test.d')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' -i'
+ \ . ' ' . g:ale_d_dfmt_options
+ \ . ' %t',
+ \ },
+ \ ale#fixers#dfmt#Fix(bufnr(''))
diff --git a/test/fixers/test_gnatpp_fixer_callback.vader b/test/fixers/test_gnatpp_fixer_callback.vader
new file mode 100644
index 00000000..a2bf898e
--- /dev/null
+++ b/test/fixers/test_gnatpp_fixer_callback.vader
@@ -0,0 +1,28 @@
+Before:
+ call ale#assert#SetUpFixerTest('ada', 'gnatpp')
+
+After:
+ " Reset fixers, variables, etc.
+ "
+ " Vader's 'Restore' command will be called here.
+ call ale#assert#TearDownFixerTest()
+
+Execute(The default command should be correct):
+ call ale#test#SetFilename('../ada_files/testfile.adb')
+
+ AssertFixer
+ \ {
+ \ 'command': ale#Escape(g:ale_ada_gnatpp_executable) .' %t',
+ \ 'read_temporary_file': 1,
+ \ }
+
+Execute(The version check should be correct):
+ call ale#test#SetFilename('../ada_files/testfile.adb')
+ let g:ale_ada_gnatpp_options = '--no-alignment'
+
+ AssertFixer
+ \ {
+ \ 'command': ale#Escape(g:ale_ada_gnatpp_executable)
+ \ . ' --no-alignment %t',
+ \ 'read_temporary_file': 1,
+ \ }
diff --git a/test/fixers/test_hindent_fixer_callback.vader b/test/fixers/test_hindent_fixer_callback.vader
new file mode 100644
index 00000000..2e5a8b9f
--- /dev/null
+++ b/test/fixers/test_hindent_fixer_callback.vader
@@ -0,0 +1,18 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The hindent callback should return the correct default values):
+ call ale#test#SetFilename('../haskell_files/testfile.hs')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('hindent')
+ \ . ' %t',
+ \ },
+ \ ale#fixers#hindent#Fix(bufnr(''))