summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorhokorobi <hokorobi.hokorobi@gmail.com>2019-01-12 23:40:03 +0900
committerw0rp <w0rp@users.noreply.github.com>2019-01-12 14:40:03 +0000
commit7f176390fc4c1b3c1a7be484e0a84c4eb8f896e3 (patch)
tree282e6c183437e2e7fe00f45b35caa8818be08793 /test
parent56b7dca6234d9922c07ca6925a74a45af0ac3b3a (diff)
downloadale-7f176390fc4c1b3c1a7be484e0a84c4eb8f896e3.zip
Support textlint for reStructuredText (#1978)
* Support textlint for reStructuredText * Add linter test for textlint rst
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_rst_textlint_command_callbacks.vader65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/command_callback/test_rst_textlint_command_callbacks.vader b/test/command_callback/test_rst_textlint_command_callbacks.vader
new file mode 100644
index 00000000..9bc4c5c2
--- /dev/null
+++ b/test/command_callback/test_rst_textlint_command_callbacks.vader
@@ -0,0 +1,65 @@
+" Author: januswel, w0rp
+
+Before:
+ " This is just one language for the linter.
+ call ale#assert#SetUpLinterTest('rst', 'textlint')
+
+ " The configuration is shared between many languages.
+ Save g:ale_textlint_executable
+ Save g:ale_textlint_use_global
+ Save g:ale_textlint_options
+
+ let g:ale_textlint_executable = 'textlint'
+ let g:ale_textlint_use_global = 0
+ let g:ale_textlint_options = ''
+
+ unlet! b:ale_textlint_executable
+ unlet! b:ale_textlint_use_global
+ unlet! b:ale_textlint_options
+
+After:
+ unlet! b:command_tail
+ unlet! b:ale_textlint_executable
+ unlet! b:ale_textlint_use_global
+ unlet! b:ale_textlint_options
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'textlint',
+ \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s'
+
+Execute(The executable should be configurable):
+ let b:ale_textlint_executable = 'foobar'
+
+ AssertLinter 'foobar',
+ \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s'
+
+Execute(The options should be configurable):
+ let b:ale_textlint_options = '--something'
+
+ AssertLinter 'textlint',
+ \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s'
+
+Execute(The local executable from .bin should be used if available):
+ call ale#test#SetFilename('textlint_paths/with_bin_path/foo.txt')
+
+ AssertLinter
+ \ ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'),
+ \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'))
+ \ . ' -f json --stdin --stdin-filename %s'
+
+Execute(The local executable from textlint/bin should be used if available):
+ call ale#test#SetFilename('textlint_paths/with_textlint_bin_path/foo.txt')
+
+ if has('win32')
+ AssertLinter
+ \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
+ \ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
+ \ . ' -f json --stdin --stdin-filename %s'
+ else
+ AssertLinter
+ \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
+ \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
+ \ . ' -f json --stdin --stdin-filename %s'
+ endif