summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-06 22:46:36 +0100
committerw0rp <devw0rp@gmail.com>2018-07-06 22:46:36 +0100
commit4999ad7e7860459f4ebea2d36d63317e88dd3870 (patch)
tree86ac5b5e5d2e32fedda53d6538b51e3bd4e0f729 /test
parent344e0fec971eccb525200665bab550380b80f9a1 (diff)
downloadale-4999ad7e7860459f4ebea2d36d63317e88dd3870.zip
Add an AssertLinter command for tests
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_tslint_command_callback.vader21
-rw-r--r--test/command_callback/test_write_good_command_callback.vader29
2 files changed, 23 insertions, 27 deletions
diff --git a/test/command_callback/test_tslint_command_callback.vader b/test/command_callback/test_tslint_command_callback.vader
index edab72c8..0c2f3abf 100644
--- a/test/command_callback/test_tslint_command_callback.vader
+++ b/test/command_callback/test_tslint_command_callback.vader
@@ -1,4 +1,6 @@
Before:
+ call ale#assert#Init()
+
Save g:ale_typescript_tslint_executable
Save g:ale_typescript_tslint_config_path
Save g:ale_typescript_tslint_rules_dir
@@ -26,26 +28,25 @@ After:
call ale#linter#Reset()
Execute(The default tslint command should be correct):
- AssertEqual
+ AssertLinter
+ \ 'tslint',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
- \ . ale#Escape('tslint') . ' --format json %t',
- \ ale_linters#typescript#tslint#GetCommand(bufnr(''))
+ \ . ale#Escape('tslint') . ' --format json %t'
Execute(The rules directory option should be included if set):
let b:ale_typescript_tslint_rules_dir = '/foo/bar'
- AssertEqual
+ AssertLinter
+ \ 'tslint',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . ale#Escape('tslint') . ' --format json'
\ . ' -r ' . ale#Escape('/foo/bar')
- \ . ' %t',
- \ ale_linters#typescript#tslint#GetCommand(bufnr(''))
+ \ . ' %t'
Execute(The executable should be configurable and escaped):
let b:ale_typescript_tslint_executable = 'foo bar'
- AssertEqual 'foo bar', ale_linters#typescript#tslint#GetExecutable(bufnr(''))
- AssertEqual
+ AssertLinter
+ \ 'foo bar',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
- \ . ale#Escape('foo bar') . ' --format json %t',
- \ ale_linters#typescript#tslint#GetCommand(bufnr(''))
+ \ . ale#Escape('foo bar') . ' --format json %t'
diff --git a/test/command_callback/test_write_good_command_callback.vader b/test/command_callback/test_write_good_command_callback.vader
index 8d9e9a00..4b5ed7b7 100644
--- a/test/command_callback/test_write_good_command_callback.vader
+++ b/test/command_callback/test_write_good_command_callback.vader
@@ -1,4 +1,6 @@
Before:
+ call ale#assert#Init()
+
Save g:ale_writegood_options
Save g:ale_writegood_executable
Save g:ale_writegood_use_global
@@ -7,6 +9,8 @@ Before:
unlet! g:ale_writegood_executable
unlet! g:ale_writegood_use_global
+ runtime ale_linters/markdown/write-good.vim
+
call ale#test#SetDirectory('/testplugin/test/command_callback')
call ale#test#SetFilename('testfile.txt')
@@ -16,42 +20,36 @@ After:
Restore
call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
Execute(The global executable should be used when the local one cannot be found):
- AssertEqual 'write-good', ale#handlers#writegood#GetExecutable(bufnr(''))
- AssertEqual
+ AssertLinter
+ \ 'write-good',
\ 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
+ AssertLinter
+ \ 'write-good',
\ 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
+ AssertLinter
\ ale#path#Simplify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good'),
- \ ale#handlers#writegood#GetExecutable(bufnr(''))
- AssertEqual
\ ale#Escape(ale#path#Simplify(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
+ AssertLinter
\ ale#path#Simplify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'),
- \ ale#handlers#writegood#GetExecutable(bufnr(''))
- AssertEqual
\ (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(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')
@@ -59,7 +57,4 @@ Execute(Should let users configure a global executable and override local paths)
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(''))
+ AssertLinter 'foo-bar', ale#Escape('foo-bar') . ' %t'