summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonzalo Quero <gquero@drwuk.com>2020-09-02 13:39:32 +0100
committerGonzalo Quero <gquero@drwuk.com>2020-11-23 10:08:00 +0000
commit7d8275daf57269df0fb8f32f421344bea6364cb5 (patch)
treeb0bf7628d51394f76d0289ebbf262442d77e2b8c
parent433b23be17095c0211685ff32e25fcdbfffe2ce7 (diff)
downloadale-7d8275daf57269df0fb8f32f421344bea6364cb5.zip
chore: Add Elixir Credo tests
-rw-r--r--test/test_elixir_credo.vader33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/test_elixir_credo.vader b/test/test_elixir_credo.vader
new file mode 100644
index 00000000..db956683
--- /dev/null
+++ b/test/test_elixir_credo.vader
@@ -0,0 +1,33 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test')
+
+ runtime ale_linters/elixir/credo.vim
+
+After:
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+ let g:ale_elixir_credo_strict = 0
+ let g:ale_elixir_credo_config_file = ''
+
+Execute(credo runs the right command):
+ call ale#test#SetFilename('elixir-test-files/testfile.ex')
+
+ AssertEqual
+ \ ale_linters#elixir#credo#GetCommand(bufnr('')),
+ \ 'cd ''.'' && mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
+
+Execute(credo runs the right command with the strict flag):
+ let g:ale_elixir_credo_strict = 1
+ call ale#test#SetFilename('elixir-test-files/testfile.ex')
+
+ AssertEqual
+ \ ale_linters#elixir#credo#GetCommand(bufnr('')),
+ \ 'cd ''.'' && mix help credo && mix credo --strict --format=flycheck --read-from-stdin %s'
+
+Execute(credo runs the right command with a custom config file):
+ let g:ale_elixir_credo_config_file = '/home/user/custom_credo.exs'
+ call ale#test#SetFilename('elixir-test-files/testfile.ex')
+
+ AssertEqual
+ \ ale_linters#elixir#credo#GetCommand(bufnr('')),
+ \ 'cd ''.'' && mix help credo && mix credo suggest --config-file /home/user/custom_credo.exs --format=flycheck --read-from-stdin %s'