summaryrefslogtreecommitdiff
path: root/test/command_callback/test_standard_command_callback.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-15 18:24:53 +0100
committerw0rp <devw0rp@gmail.com>2018-07-15 18:28:28 +0100
commita42999a639b2916b769a85f37d037be314d9d61b (patch)
tree5ebfb4d357dc673efa93fd32a66b489c4510de40 /test/command_callback/test_standard_command_callback.vader
parent5155a35a80fe3b20659eb0f28cc6cc720532dd3f (diff)
downloadale-a42999a639b2916b769a85f37d037be314d9d61b.zip
Massively reduce the amount of code needed for linter tests
Diffstat (limited to 'test/command_callback/test_standard_command_callback.vader')
-rw-r--r--test/command_callback/test_standard_command_callback.vader62
1 files changed, 9 insertions, 53 deletions
diff --git a/test/command_callback/test_standard_command_callback.vader b/test/command_callback/test_standard_command_callback.vader
index 3dee2856..a47e2ec9 100644
--- a/test/command_callback/test_standard_command_callback.vader
+++ b/test/command_callback/test_standard_command_callback.vader
@@ -1,28 +1,10 @@
Before:
- Save g:ale_javascript_standard_executable
- Save g:ale_javascript_standard_use_global
- Save g:ale_javascript_standard_options
-
- unlet! b:executable
- unlet! g:ale_javascript_standard_executable
- unlet! b:ale_javascript_standard_executable
- unlet! g:ale_javascript_standard_use_global
- unlet! g:ale_javascript_standard_options
-
- call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#assert#SetUpLinterTest('javascript', 'standard')
call ale#test#SetFilename('testfile.js')
-
- runtime ale_linters/javascript/standard.vim
-
-After:
- Restore
-
unlet! b:executable
- call ale#test#SetFilename('test.txt')
-
- call ale#test#RestoreDirectory()
- call ale#linter#Reset()
+After:
+ call ale#assert#TearDownLinterTest()
Execute(bin/cmd.js paths should be preferred):
call ale#test#SetFilename('standard-test-files/with-cmd/testfile.js')
@@ -32,15 +14,10 @@ Execute(bin/cmd.js paths should be preferred):
\ . '/standard-test-files/with-cmd/node_modules/standard/bin/cmd.js'
\)
- AssertEqual
- \ b:executable,
- \ ale_linters#javascript#standard#GetExecutable(bufnr(''))
-
- AssertEqual
+ AssertLinter b:executable,
\ (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(b:executable)
- \ . ' --stdin %s',
- \ ale_linters#javascript#standard#GetCommand(bufnr(''))
+ \ . ' --stdin %s'
Execute(.bin directories should be used too):
call ale#test#SetFilename('standard-test-files/with-bin/testfile.js')
@@ -50,38 +27,17 @@ Execute(.bin directories should be used too):
\ . '/standard-test-files/with-bin/node_modules/.bin/standard'
\)
- AssertEqual
- \ b:executable,
- \ ale_linters#javascript#standard#GetExecutable(bufnr(''))
-
- AssertEqual
- \ ale#Escape(b:executable)
- \ . ' --stdin %s',
- \ ale_linters#javascript#standard#GetCommand(bufnr(''))
+ AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin %s'
Execute(The global executable should be used otherwise):
- AssertEqual
- \ 'standard',
- \ ale_linters#javascript#standard#GetExecutable(bufnr(''))
-
- AssertEqual
- \ ale#Escape('standard') . ' --stdin %s',
- \ ale_linters#javascript#standard#GetCommand(bufnr(''))
+ AssertLinter 'standard', ale#Escape('standard') . ' --stdin %s'
Execute(The global executable should be configurable):
let b:ale_javascript_standard_executable = 'foobar'
- AssertEqual
- \ 'foobar',
- \ ale_linters#javascript#standard#GetExecutable(bufnr(''))
-
- AssertEqual
- \ ale#Escape('foobar') . ' --stdin %s',
- \ ale_linters#javascript#standard#GetCommand(bufnr(''))
+ AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin %s'
Execute(The options should be configurable):
let b:ale_javascript_standard_options = '--wat'
- AssertEqual
- \ ale#Escape('standard') . ' --wat --stdin %s',
- \ ale_linters#javascript#standard#GetCommand(bufnr(''))
+ AssertLinter 'standard', ale#Escape('standard') . ' --wat --stdin %s'