summaryrefslogtreecommitdiff
path: root/test/command_callback/test_lessc_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_lessc_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_lessc_command_callback.vader')
-rw-r--r--test/command_callback/test_lessc_command_callback.vader74
1 files changed, 19 insertions, 55 deletions
diff --git a/test/command_callback/test_lessc_command_callback.vader b/test/command_callback/test_lessc_command_callback.vader
index ec2899d1..79f57d06 100644
--- a/test/command_callback/test_lessc_command_callback.vader
+++ b/test/command_callback/test_lessc_command_callback.vader
@@ -1,31 +1,13 @@
Before:
- Save g:ale_less_lessc_executable
- Save g:ale_less_lessc_use_global
- Save g:ale_less_lessc_options
-
- unlet! b:executable
-
- unlet! g:ale_less_lessc_executable
- unlet! g:ale_less_lessc_use_global
- unlet! g:ale_less_lessc_options
-
- call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#assert#SetUpLinterTest('less', 'lessc')
call ale#test#SetFilename('testfile.less')
- runtime ale_linters/less/lessc.vim
+ unlet! b:executable
After:
- Restore
-
unlet! b:executable
- unlet! b:ale_less_lessc_executable
- unlet! b:ale_less_lessc_use_global
- unlet! b:ale_less_lessc_options
-
- call ale#test#SetFilename('test.txt')
- call ale#test#RestoreDirectory()
- call ale#linter#Reset()
+ call ale#assert#TearDownLinterTest()
Execute(node_modules directories should be discovered):
call ale#test#SetFilename('lessc_paths/nested/testfile.less')
@@ -35,17 +17,11 @@ Execute(node_modules directories should be discovered):
\ . '/lessc_paths/node_modules/.bin/lessc'
\)
- AssertEqual
- \ b:executable,
- \ ale_linters#less#lessc#GetExecutable(bufnr(''))
-
- AssertEqual
- \ ale#Escape(b:executable)
- \ . ' --no-color --lint'
- \ . ' --include-path='
- \ . ale#Escape(ale#path#Simplify(g:dir . '/lessc_paths/nested'))
- \ . ' -',
- \ ale_linters#less#lessc#GetCommand(bufnr(''))
+ AssertLinter b:executable, ale#Escape(b:executable)
+ \ . ' --no-color --lint'
+ \ . ' --include-path='
+ \ . ale#Escape(ale#path#Simplify(g:dir . '/lessc_paths/nested'))
+ \ . ' -'
Execute(The global override should work):
let b:ale_less_lessc_executable = 'foobar'
@@ -53,30 +29,18 @@ Execute(The global override should work):
call ale#test#SetFilename('lessc_paths/nested/testfile.less')
- AssertEqual
- \ 'foobar',
- \ ale_linters#less#lessc#GetExecutable(bufnr(''))
-
- AssertEqual
- \ ale#Escape('foobar')
- \ . ' --no-color --lint'
- \ . ' --include-path='
- \ . ale#Escape(ale#path#Simplify(g:dir . '/lessc_paths/nested'))
- \ . ' -',
- \ ale_linters#less#lessc#GetCommand(bufnr(''))
+ AssertLinter 'foobar', ale#Escape('foobar')
+ \ . ' --no-color --lint'
+ \ . ' --include-path='
+ \ . ale#Escape(ale#path#Simplify(g:dir . '/lessc_paths/nested'))
+ \ . ' -'
Execute(Extra options should be configurable):
let b:ale_less_lessc_options = '--whatever'
- AssertEqual
- \ 'lessc',
- \ ale_linters#less#lessc#GetExecutable(bufnr(''))
-
- AssertEqual
- \ ale#Escape('lessc')
- \ . ' --no-color --lint'
- \ . ' --include-path='
- \ . ale#Escape(ale#path#Simplify(g:dir))
- \ . ' --whatever'
- \ . ' -',
- \ ale_linters#less#lessc#GetCommand(bufnr(''))
+ AssertLinter 'lessc', ale#Escape('lessc')
+ \ . ' --no-color --lint'
+ \ . ' --include-path='
+ \ . ale#Escape(ale#path#Simplify(g:dir))
+ \ . ' --whatever'
+ \ . ' -'