summaryrefslogtreecommitdiff
path: root/test/fixers
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixers')
-rw-r--r--test/fixers/test_html_beautify_fixer_callback.vader16
-rw-r--r--test/fixers/test_nimpretty_fixer_callback.vader23
-rw-r--r--test/fixers/test_purty_fixer_callback.vader24
-rw-r--r--test/fixers/test_stylelint_fixer_callback.vader32
-rw-r--r--test/fixers/test_styler_fixer_callback.vader2
5 files changed, 88 insertions, 9 deletions
diff --git a/test/fixers/test_html_beautify_fixer_callback.vader b/test/fixers/test_html_beautify_fixer_callback.vader
new file mode 100644
index 00000000..372572e4
--- /dev/null
+++ b/test/fixers/test_html_beautify_fixer_callback.vader
@@ -0,0 +1,16 @@
+Before:
+ call ale#assert#SetUpFixerTest('html', 'html-beautify', 'beautify')
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+ silent cd ..
+ silent cd command_callback
+
+After:
+ Restore
+
+ call ale#assert#TearDownFixerTest()
+
+Execute(The html-beautify callback should return the correct default command):
+ AssertEqual
+ \ {'command': ale#Escape('html-beautify') . ' -'},
+ \ ale#fixers#html_beautify#Fix(bufnr(''))
diff --git a/test/fixers/test_nimpretty_fixer_callback.vader b/test/fixers/test_nimpretty_fixer_callback.vader
new file mode 100644
index 00000000..a26f649a
--- /dev/null
+++ b/test/fixers/test_nimpretty_fixer_callback.vader
@@ -0,0 +1,23 @@
+Before:
+ call ale#assert#SetUpFixerTest('nim', 'nimpretty')
+
+After:
+ call ale#assert#TearDownFixerTest()
+
+Execute(The nimpretty callback should return the correct default values):
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('nimpretty') . ' %t --maxLineLen:80'
+ \ },
+ \ ale#fixers#nimpretty#Fix(bufnr(''))
+
+Execute(The nimpretty callback should include any additional options):
+ let g:ale_nim_nimpretty_options = '--some-option'
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('nimpretty') . ' %t --some-option'
+ \ },
+ \ ale#fixers#nimpretty#Fix(bufnr(''))
diff --git a/test/fixers/test_purty_fixer_callback.vader b/test/fixers/test_purty_fixer_callback.vader
new file mode 100644
index 00000000..e83b8c18
--- /dev/null
+++ b/test/fixers/test_purty_fixer_callback.vader
@@ -0,0 +1,24 @@
+Before:
+ Save g:ale_purescript_purty_executable
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_purescript_purty_executable = 'my-special-purty'
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The purty callback should return the correct options):
+ call ale#test#SetFilename('../purescript_files/testfile.purs')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('my-special-purty')
+ \ . ' --write'
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \ },
+ \ ale#fixers#purty#Fix(bufnr(''))
diff --git a/test/fixers/test_stylelint_fixer_callback.vader b/test/fixers/test_stylelint_fixer_callback.vader
index 90a9dc1f..f677cdf7 100644
--- a/test/fixers/test_stylelint_fixer_callback.vader
+++ b/test/fixers/test_stylelint_fixer_callback.vader
@@ -1,17 +1,33 @@
Before:
- call ale#test#SetDirectory('/testplugin/test/fixers')
+ call ale#assert#SetUpFixerTest('css', 'stylelint')
After:
- call ale#test#RestoreDirectory()
+ call ale#assert#TearDownFixerTest()
-Execute(The executable path should be correct):
+Execute(The stylelint callback should return the correct default values):
call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.css')
- AssertEqual
+ AssertFixer
\ {
\ 'read_temporary_file': 1,
- \ 'command': (has('win32') ? 'node.exe ' : '')
+ \ 'command': ale#path#CdString(expand('%:p:h'))
+ \ . (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
- \ . ' --fix %t',
- \ },
- \ ale#fixers#stylelint#Fix(bufnr(''))
+ \ . ' %t'
+ \ . ' --fix',
+ \ }
+
+Execute(The stylelint callback should include custom stylelint options):
+ let g:ale_stylelint_options = '--cache'
+ call ale#test#SetFilename('../eslint-test-files/react-app/subdir/testfile.css')
+
+ AssertFixer
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#path#CdString(expand('%:p:h'))
+ \ . (has('win32') ? 'node.exe ' : '')
+ \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
+ \ . ' %t'
+ \ . ' --cache'
+ \ . ' --fix',
+ \ }
diff --git a/test/fixers/test_styler_fixer_callback.vader b/test/fixers/test_styler_fixer_callback.vader
index 85e45c1d..79f71ba9 100644
--- a/test/fixers/test_styler_fixer_callback.vader
+++ b/test/fixers/test_styler_fixer_callback.vader
@@ -13,7 +13,7 @@ Execute(The styler callback should include custom styler options):
\ {
\ 'command': 'Rscript --vanilla -e '
\ . '"suppressPackageStartupMessages(library(styler));'
- \ . 'style_file(commandArgs(TRUE), style = '
+ \ . 'style_file(commandArgs(TRUE), transformers = '
\ . 'a_custom_option)"'
\ . ' %t',
\ 'read_temporary_file': 1,