From 15f44933c2a7e2917b37e666dec4fe53a342bc11 Mon Sep 17 00:00:00 2001 From: pinicarus Date: Wed, 28 Oct 2020 11:48:57 +0100 Subject: feat(erlang/erlc): add option for custom executable --- .../test_erlang_erlc_command_callback.vader | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/command_callback/test_erlang_erlc_command_callback.vader (limited to 'test/command_callback') diff --git a/test/command_callback/test_erlang_erlc_command_callback.vader b/test/command_callback/test_erlang_erlc_command_callback.vader new file mode 100644 index 00000000..e101bb43 --- /dev/null +++ b/test/command_callback/test_erlang_erlc_command_callback.vader @@ -0,0 +1,40 @@ +Before: + call ale#assert#SetUpLinterTest('erlang', 'erlc') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct.): + let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) + let g:regex = '^''erlc''\s\+-o\s\+[^\s]\+\s\+%t' + let g:matched = match(g:cmd, g:regex) + + " match returns -1 if not found + AssertNotEqual + \ g:matched, + \ -1, + \ 'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']' + +Execute(The command should accept configured executable.): + let b:ale_erlang_erlc_executable = '/usr/bin/erlc' + let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) + let g:regex = '^''/usr/bin/erlc''\s\+-o\s\+[^\s]\+\s\+%t' + let g:matched = match(g:cmd, g:regex) + + " match returns -1 if not found + AssertNotEqual + \ g:matched, + \ -1, + \ 'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']' + +Execute(The command should accept configured options.): + let b:ale_erlang_erlc_options = '-I include' + let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) + let g:regex = '^''erlc''\s\+-o\s\+[^\s]\+\s\+-I include\s\+%t' + let g:matched = match(g:cmd, g:regex) + + " match returns -1 if not found + AssertNotEqual + \ g:matched, + \ -1, + \ 'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']' -- cgit v1.2.3 From 7d69cdf4adc8ad2badb0d032572837471992b563 Mon Sep 17 00:00:00 2001 From: pinicarus Date: Wed, 28 Oct 2020 12:51:38 +0100 Subject: test(erlang/erlc): make quotes optional in matches --- test/command_callback/test_erlang_erlc_command_callback.vader | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/command_callback') diff --git a/test/command_callback/test_erlang_erlc_command_callback.vader b/test/command_callback/test_erlang_erlc_command_callback.vader index e101bb43..ce390338 100644 --- a/test/command_callback/test_erlang_erlc_command_callback.vader +++ b/test/command_callback/test_erlang_erlc_command_callback.vader @@ -6,7 +6,7 @@ After: Execute(The default command should be correct.): let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) - let g:regex = '^''erlc''\s\+-o\s\+[^\s]\+\s\+%t' + let g:regex = '^''\?erlc''\?\s\+-o\s\+[^\s]\+\s\+%t' let g:matched = match(g:cmd, g:regex) " match returns -1 if not found @@ -18,7 +18,7 @@ Execute(The default command should be correct.): Execute(The command should accept configured executable.): let b:ale_erlang_erlc_executable = '/usr/bin/erlc' let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) - let g:regex = '^''/usr/bin/erlc''\s\+-o\s\+[^\s]\+\s\+%t' + let g:regex = '^''\?/usr/bin/erlc''\?\s\+-o\s\+[^\s]\+\s\+%t' let g:matched = match(g:cmd, g:regex) " match returns -1 if not found @@ -30,7 +30,7 @@ Execute(The command should accept configured executable.): Execute(The command should accept configured options.): let b:ale_erlang_erlc_options = '-I include' let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) - let g:regex = '^''erlc''\s\+-o\s\+[^\s]\+\s\+-I include\s\+%t' + let g:regex = '^''\?erlc''\?\s\+-o\s\+[^\s]\+\s\+-I include\s\+%t' let g:matched = match(g:cmd, g:regex) " match returns -1 if not found -- cgit v1.2.3 From 62f2c6d3261af41ef01db6868724881fd6eebccc Mon Sep 17 00:00:00 2001 From: pinicarus Date: Wed, 28 Oct 2020 12:58:15 +0100 Subject: test(erlang/erlc): simplify matches --- test/command_callback/test_erlang_erlc_command_callback.vader | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/command_callback') diff --git a/test/command_callback/test_erlang_erlc_command_callback.vader b/test/command_callback/test_erlang_erlc_command_callback.vader index ce390338..7d659a07 100644 --- a/test/command_callback/test_erlang_erlc_command_callback.vader +++ b/test/command_callback/test_erlang_erlc_command_callback.vader @@ -6,7 +6,7 @@ After: Execute(The default command should be correct.): let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) - let g:regex = '^''\?erlc''\?\s\+-o\s\+[^\s]\+\s\+%t' + let g:regex = 'erlc.\+-o.\+%t' let g:matched = match(g:cmd, g:regex) " match returns -1 if not found @@ -18,7 +18,7 @@ Execute(The default command should be correct.): Execute(The command should accept configured executable.): let b:ale_erlang_erlc_executable = '/usr/bin/erlc' let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) - let g:regex = '^''\?/usr/bin/erlc''\?\s\+-o\s\+[^\s]\+\s\+%t' + let g:regex = '/usr/bin/erlc.\+-o.\+%t' let g:matched = match(g:cmd, g:regex) " match returns -1 if not found @@ -30,7 +30,7 @@ Execute(The command should accept configured executable.): Execute(The command should accept configured options.): let b:ale_erlang_erlc_options = '-I include' let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr('')) - let g:regex = '^''\?erlc''\?\s\+-o\s\+[^\s]\+\s\+-I include\s\+%t' + let g:regex = 'erlc.\+-o.\+-I include.\+%t' let g:matched = match(g:cmd, g:regex) " match returns -1 if not found -- cgit v1.2.3