From a42999a639b2916b769a85f37d037be314d9d61b Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 15 Jul 2018 18:24:53 +0100 Subject: Massively reduce the amount of code needed for linter tests --- .../test_slimlint_command_callback.vader | 38 +++++----------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'test/command_callback/test_slimlint_command_callback.vader') diff --git a/test/command_callback/test_slimlint_command_callback.vader b/test/command_callback/test_slimlint_command_callback.vader index 38588a1f..3522c2fa 100644 --- a/test/command_callback/test_slimlint_command_callback.vader +++ b/test/command_callback/test_slimlint_command_callback.vader @@ -1,39 +1,19 @@ Before: - runtime ale_linters/slim/slimlint.vim - + call ale#assert#SetUpLinterTest('slim', 'slimlint') let g:default_command = 'slim-lint %t' - call ale#test#SetDirectory('/testplugin/test/command_callback') - After: - Restore - - unlet! g:default_command - unlet! b:conf - - call ale#linter#Reset() - call ale#test#RestoreDirectory() + call ale#assert#TearDownLinterTest() Execute(The default command should be correct): - AssertEqual g:default_command, ale_linters#slim#slimlint#GetCommand(bufnr('')) + AssertLinter 'slim-lint', 'slim-lint %t' Execute(The command should have the .rubocop.yml prepended as an env var if one exists): call ale#test#SetFilename('../slimlint-test-files/subdir/file.slim') - let b:conf = ale#path#Simplify(g:dir . '/../slimlint-test-files/.rubocop.yml') - - if has('win32') - " Windows uses 'set var=... && command' - AssertEqual - \ 'set SLIM_LINT_RUBOCOP_CONF=' - \ . ale#Escape(b:conf) - \ . ' && ' . g:default_command, - \ ale_linters#slim#slimlint#GetCommand(bufnr('')) - else - " Unix uses 'var=... command' - AssertEqual - \ 'SLIM_LINT_RUBOCOP_CONF=' - \ . ale#Escape(b:conf) - \ . ' ' . g:default_command, - \ ale_linters#slim#slimlint#GetCommand(bufnr('')) - endif + AssertLinter 'slim-lint', + \ ale#Env( + \ 'SLIM_LINT_RUBOCOP_CONF', + \ ale#path#Simplify(g:dir . '/../slimlint-test-files/.rubocop.yml') + \ ) + \ . 'slim-lint %t' -- cgit v1.2.3