summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/elixir_paths/mix_project/lib/app.ex (renamed from test/command_callback/elixir_paths/mix_project/lib/foo.ex)0
-rw-r--r--test/command_callback/mix_paths/wrapped_project/mix.exs1
-rw-r--r--test/command_callback/test_elixir_mix_command_callbacks.vader4
-rw-r--r--test/command_callback/test_golint_command_callbacks.vader18
-rw-r--r--test/fix/test_ale_fix.vader33
-rw-r--r--test/fixers/test_ocamlformat_fixer_callback.vader10
-rw-r--r--test/test_ale_info.vader5
7 files changed, 59 insertions, 12 deletions
diff --git a/test/command_callback/elixir_paths/mix_project/lib/foo.ex b/test/command_callback/elixir_paths/mix_project/lib/app.ex
index e69de29b..e69de29b 100644
--- a/test/command_callback/elixir_paths/mix_project/lib/foo.ex
+++ b/test/command_callback/elixir_paths/mix_project/lib/app.ex
diff --git a/test/command_callback/mix_paths/wrapped_project/mix.exs b/test/command_callback/mix_paths/wrapped_project/mix.exs
deleted file mode 100644
index d2d855e6..00000000
--- a/test/command_callback/mix_paths/wrapped_project/mix.exs
+++ /dev/null
@@ -1 +0,0 @@
-use Mix.Config
diff --git a/test/command_callback/test_elixir_mix_command_callbacks.vader b/test/command_callback/test_elixir_mix_command_callbacks.vader
index ec7b9911..b0d0af98 100644
--- a/test/command_callback/test_elixir_mix_command_callbacks.vader
+++ b/test/command_callback/test_elixir_mix_command_callbacks.vader
@@ -11,10 +11,10 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The default mix command should be correct):
- call ale#test#SetFilename('mix_paths/wrapped_project/lib/app.ex')
+ call ale#test#SetFilename('elixir_paths/mix_project/lib/app.ex')
AssertLinter 'mix',
- \ ale#path#CdString(ale#path#Simplify(g:dir . '/mix_paths/wrapped_project'))
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
\ . g:env_prefix
\ . 'mix compile %s'
diff --git a/test/command_callback/test_golint_command_callbacks.vader b/test/command_callback/test_golint_command_callbacks.vader
new file mode 100644
index 00000000..7c300309
--- /dev/null
+++ b/test/command_callback/test_golint_command_callbacks.vader
@@ -0,0 +1,18 @@
+Before:
+ call ale#assert#SetUpLinterTest('go', 'golint')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default golint command should be correct):
+ AssertLinter 'golint', ale#Escape('golint') . ' %t'
+
+Execute(The golint executable should be configurable):
+ let b:ale_go_golint_executable = 'foobar'
+
+ AssertLinter 'foobar', ale#Escape('foobar') . ' %t'
+
+Execute(The golint options should be configurable):
+ let b:ale_go_golint_options = '--foo'
+
+ AssertLinter 'golint', ale#Escape('golint') . ' --foo %t'
diff --git a/test/fix/test_ale_fix.vader b/test/fix/test_ale_fix.vader
index 539972a4..90407681 100644
--- a/test/fix/test_ale_fix.vader
+++ b/test/fix/test_ale_fix.vader
@@ -180,6 +180,7 @@ After:
unlet! g:ale_emulate_job_failure
unlet! b:ale_fixers
unlet! b:ale_fix_on_save
+ unlet! b:ale_quitting
delfunction AddCarets
delfunction AddDollars
delfunction DoNothing
@@ -431,7 +432,7 @@ Given testft (A file with three lines):
b
c
-Execute(ALEFix should save files on the save event):
+Execute(ALEFix should fix files on the save event):
let g:ale_fix_on_save = 1
let g:ale_lint_on_save = 1
let g:ale_enabled = 1
@@ -471,6 +472,36 @@ Expect(The buffer should be modified):
$b
$c
+Execute(ALEFix should not fix files on :wq):
+ let g:ale_fix_on_save = 1
+ let g:ale_lint_on_save = 1
+ let g:ale_enabled = 1
+
+ noautocmd silent file fix_test_file
+ call writefile(getline(1, '$'), 'fix_test_file')
+
+ let g:ale_fixers.testft = ['AddDollars']
+
+ " We have to set the buftype to empty so the file will be written.
+ setlocal buftype=
+
+ call ale#events#QuitEvent(bufnr(''))
+
+ call SetUpLinters()
+ call ale#events#SaveEvent(bufnr(''))
+
+ " We should save the file.
+ AssertEqual ['a', 'b', 'c'], readfile('fix_test_file')
+ Assert &modified, 'The was not marked as ''modified'''
+
+ " We should not run the linter.
+ AssertEqual [], ale#test#GetLoclistWithoutModule()
+
+Expect(The buffer should not be modified):
+ a
+ b
+ c
+
Given testft (A file with three lines):
a
b
diff --git a/test/fixers/test_ocamlformat_fixer_callback.vader b/test/fixers/test_ocamlformat_fixer_callback.vader
index d2aee066..f0c36ed7 100644
--- a/test/fixers/test_ocamlformat_fixer_callback.vader
+++ b/test/fixers/test_ocamlformat_fixer_callback.vader
@@ -18,10 +18,9 @@ Execute(The ocamlformat callback should return the correct default values):
AssertEqual
\ {
- \ 'read_temporary_file': 1,
\ 'command': ale#Escape('xxxinvalid')
- \ . ' --inplace'
- \ . ' %t',
+ \ . ' --name=' . ale#Escape(bufname(bufnr('')))
+ \ . ' -',
\ },
\ ale#fixers#ocamlformat#Fix(bufnr(''))
@@ -31,10 +30,9 @@ Execute(The ocamlformat callback should include custom ocamlformat options):
AssertEqual
\ {
- \ 'read_temporary_file': 1,
\ 'command': ale#Escape('xxxinvalid')
\ . ' ' . g:ale_ocaml_ocamlformat_options
- \ . ' --inplace'
- \ . ' %t',
+ \ . ' --name=' . ale#Escape(bufname(bufnr('')))
+ \ . ' -',
\ },
\ ale#fixers#ocamlformat#Fix(bufnr(''))
diff --git a/test/test_ale_info.vader b/test/test_ale_info.vader
index 39a2a85a..325c2aa8 100644
--- a/test/test_ale_info.vader
+++ b/test/test_ale_info.vader
@@ -88,14 +88,14 @@ Before:
\ 'let g:ale_lint_delay = 200',
\ 'let g:ale_lint_on_enter = 1',
\ 'let g:ale_lint_on_filetype_changed = 1',
+ \ 'let g:ale_lint_on_insert_leave = 0',
\ 'let g:ale_lint_on_save = 1',
\ 'let g:ale_lint_on_text_changed = ''always''',
- \ 'let g:ale_lint_on_insert_leave = 0',
\ 'let g:ale_linter_aliases = {}',
\ 'let g:ale_linters = {}',
\ 'let g:ale_linters_explicit = 0',
- \ 'let g:ale_list_window_size = 10',
\ 'let g:ale_list_vertical = 0',
+ \ 'let g:ale_list_window_size = 10',
\ 'let g:ale_loclist_msg_format = ''%code: %%s''',
\ 'let g:ale_max_buffer_history_size = 20',
\ 'let g:ale_max_signs = -1',
@@ -118,6 +118,7 @@ Before:
\ 'let g:ale_statusline_format = [''%d error(s)'', ''%d warning(s)'', ''OK'']',
\ 'let g:ale_type_map = {}',
\ 'let g:ale_use_global_executables = v:null',
+ \ 'let g:ale_virtualtext_cursor = 0',
\ 'let g:ale_warn_about_trailing_blank_lines = 1',
\ 'let g:ale_warn_about_trailing_whitespace = 1',
\]