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_terraform_tflint_command_callback.vader | 29 +++++++--------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'test/command_callback/test_terraform_tflint_command_callback.vader') diff --git a/test/command_callback/test_terraform_tflint_command_callback.vader b/test/command_callback/test_terraform_tflint_command_callback.vader index a4ae56b0..c32d9bcf 100644 --- a/test/command_callback/test_terraform_tflint_command_callback.vader +++ b/test/command_callback/test_terraform_tflint_command_callback.vader @@ -1,30 +1,19 @@ Before: - Save g:ale_terraform_tflint_executable - Save g:ale_terraform_tflint_options - - runtime ale_linters/terraform/tflint.vim + call ale#assert#SetUpLinterTest('terraform', 'tflint') After: - Restore + call ale#assert#TearDownLinterTest() - call ale#linter#Reset() +Execute(The default command should be correct): + AssertLinter 'tflint', ale#Escape('tflint') . ' -f json %t' Execute(The default executable should be configurable): - AssertEqual 'tflint', ale_linters#terraform#tflint#GetExecutable(bufnr('')) - - let g:ale_terraform_tflint_executable = 'asdf' + let b:ale_terraform_tflint_executable = 'asdf' - AssertEqual 'asdf', ale_linters#terraform#tflint#GetExecutable(bufnr('')) + AssertLinter 'asdf', ale#Escape('asdf') . ' -f json %t' -Execute(The default command should be good): - let g:ale_terraform_tflint_executable = 'tflint' - AssertEqual - \ ale#Escape('tflint') . ' -f json %t', - \ ale_linters#terraform#tflint#GetCommand(bufnr('')) - -Execute(Overriding things should work): +Execute(Overriding options should work): let g:ale_terraform_tflint_executable = 'fnord' let g:ale_terraform_tflint_options = '--whatever' - AssertEqual - \ ale#Escape('fnord') . ' --whatever -f json %t', - \ ale_linters#terraform#tflint#GetCommand(bufnr('')) + + AssertLinter 'fnord', ale#Escape('fnord') . ' --whatever -f json %t' -- cgit v1.2.3