summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_write_good_command_callback.vader65
-rw-r--r--test/command_callback/write-good-node-modules-2/node_modules/write-good/bin/write-good.js0
-rw-r--r--test/command_callback/write-good-node-modules/node_modules/.bin/write-good0
-rw-r--r--test/handler/test_write_good_handler.vader21
-rwxr-xr-xtest/script/check-toc2
5 files changed, 87 insertions, 1 deletions
diff --git a/test/command_callback/test_write_good_command_callback.vader b/test/command_callback/test_write_good_command_callback.vader
new file mode 100644
index 00000000..86e6f507
--- /dev/null
+++ b/test/command_callback/test_write_good_command_callback.vader
@@ -0,0 +1,65 @@
+Before:
+ Save g:ale_writegood_options
+ Save g:ale_writegood_executable
+ Save g:ale_writegood_use_global
+
+ unlet! g:ale_writegood_options
+ unlet! g:ale_writegood_executable
+ unlet! g:ale_writegood_use_global
+
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#test#SetFilename('testfile.txt')
+
+ call ale#handlers#writegood#ResetOptions()
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The global executable should be used when the local one cannot be found):
+ AssertEqual 'write-good', ale#handlers#writegood#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape('write-good') . ' %t',
+ \ ale#handlers#writegood#GetCommand(bufnr(''))
+
+Execute(The options should be used in the command):
+ let g:ale_writegood_options = '--foo --bar'
+
+ AssertEqual
+ \ ale#Escape('write-good') . ' --foo --bar %t',
+ \ ale#handlers#writegood#GetCommand(bufnr(''))
+
+Execute(Should use the node_modules/.bin executable, if available):
+ call ale#test#SetFilename('write-good-node-modules/test.txt')
+
+ AssertEqual
+ \ ale#path#Winify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good'),
+ \ ale#handlers#writegood#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape(ale#path#Winify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good'))
+ \ . ' %t',
+ \ ale#handlers#writegood#GetCommand(bufnr(''))
+
+Execute(Should use the node_modules/write-good executable, if available):
+ call ale#test#SetFilename('write-good-node-modules-2/test.txt')
+
+ AssertEqual
+ \ ale#path#Winify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'),
+ \ ale#handlers#writegood#GetExecutable(bufnr(''))
+ AssertEqual
+ \ (has('win32') ? 'node' : '')
+ \ . ale#Escape(ale#path#Winify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'))
+ \ . ' %t',
+ \ ale#handlers#writegood#GetCommand(bufnr(''))
+
+Execute(Should let users configure a global executable and override local paths):
+ call ale#test#SetFilename('write-good-node-modules-2/test.txt')
+
+ let g:ale_writegood_executable = 'foo-bar'
+ let g:ale_writegood_use_global = 1
+
+ AssertEqual 'foo-bar', ale#handlers#writegood#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape('foo-bar') . ' %t',
+ \ ale#handlers#writegood#GetCommand(bufnr(''))
diff --git a/test/command_callback/write-good-node-modules-2/node_modules/write-good/bin/write-good.js b/test/command_callback/write-good-node-modules-2/node_modules/write-good/bin/write-good.js
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/write-good-node-modules-2/node_modules/write-good/bin/write-good.js
diff --git a/test/command_callback/write-good-node-modules/node_modules/.bin/write-good b/test/command_callback/write-good-node-modules/node_modules/.bin/write-good
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/write-good-node-modules/node_modules/.bin/write-good
diff --git a/test/handler/test_write_good_handler.vader b/test/handler/test_write_good_handler.vader
new file mode 100644
index 00000000..b3eeb1b7
--- /dev/null
+++ b/test/handler/test_write_good_handler.vader
@@ -0,0 +1,21 @@
+Execute(The write-good handler should handle the example from the write-good README):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 1,
+ \ 'type': 'W',
+ \ 'text': '"So" adds no meaning',
+ \ }
+ \ ],
+ \ ale#handlers#writegood#Handle(bufnr(''), [
+ \ 'In /tmp/vBYivbZ/6/test.md',
+ \ '=============',
+ \ 'So the cat was stolen.',
+ \ '^^',
+ \ '"So" adds no meaning on line 1 at column 0',
+ \ '-------------',
+ \ 'So the cat was stolen.',
+ \ ' ^^^^^^^^^^',
+ \ '"was stolen" may be passive voice on line 1 at column 11 ',
+ \ ])
diff --git a/test/script/check-toc b/test/script/check-toc
index 426d5a1d..cc2d2b9c 100755
--- a/test/script/check-toc
+++ b/test/script/check-toc
@@ -30,7 +30,7 @@ sed -n "$toc_start_line,$toc_end_line"p doc/ale.txt \
doc_files="$(/bin/ls -1v doc | grep ^ale- | sed 's/^/doc\//' | paste -sd ' ' -)"
# shellcheck disable=SC2086
-grep -h 'ale-.*-options\|^[a-z].*\*ale-.*\*$' $doc_files \
+grep -h '\*ale-.*-options\|^[a-z].*\*ale-.*\*$' $doc_files \
| sed 's/^/ /' \
| sed 's/ALE Shell Integration/ALE sh Integration/' \
| sed 's/ ALE \(.*\) Integration/\1/' \