summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_c_clang_command_callbacks.vader4
-rw-r--r--test/command_callback/test_c_gcc_command_callbacks.vader4
-rw-r--r--test/command_callback/test_cpp_clang_command_callbacks.vader4
-rw-r--r--test/command_callback/test_cpp_gcc_command_callbacks.vader4
-rw-r--r--test/command_callback/test_gosimple_command_callback.vader12
-rw-r--r--test/command_callback/test_gotype_command_callback.vader12
-rw-r--r--test/command_callback/test_textlint_command_callbacks.vader85
-rw-r--r--test/command_callback/test_tslint_command_callback.vader16
-rwxr-xr-xtest/command_callback/textlint_paths/with_bin_path/node_modules/.bin/textlint0
-rwxr-xr-xtest/command_callback/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js0
-rw-r--r--test/fix/test_ale_fix.vader15
-rw-r--r--test/fixers/test_mix_format_fixer_callback.vader18
-rw-r--r--test/fixers/test_rufo_fixer_callback.vader33
-rw-r--r--test/handler/test_fish_handler.vader22
-rw-r--r--test/handler/test_go_generic_handler.vader (renamed from test/handler/test_govet_handler.vader)10
-rw-r--r--test/handler/test_markdownlint_handler.vader24
-rw-r--r--test/handler/test_qmllint_handler.vader19
-rw-r--r--test/handler/test_redpen_handler.vader24
-rw-r--r--test/handler/test_remark_lint_handler.vader11
-rw-r--r--test/handler/test_textlint_handler.vader41
-rw-r--r--test/test_ale_toggle.vader40
-rw-r--r--test/test_balloon_messages.vader51
-rw-r--r--test/test_c_import_paths.vader34
-rw-r--r--test/test_c_parse_makefile.vader184
-rw-r--r--test/test_c_projects/makefile_project/subdir/file.c0
-rw-r--r--test/test_loclist_corrections.vader2
26 files changed, 616 insertions, 53 deletions
diff --git a/test/command_callback/test_c_clang_command_callbacks.vader b/test/command_callback/test_c_clang_command_callbacks.vader
index d6fc8ca6..2f6d4dd0 100644
--- a/test/command_callback/test_c_clang_command_callbacks.vader
+++ b/test/command_callback/test_c_clang_command_callbacks.vader
@@ -30,10 +30,10 @@ Execute(The executable should be configurable):
Execute(The executable should be used in the command):
AssertEqual
\ ale#Escape('clang') . b:command_tail,
- \ ale_linters#c#clang#GetCommand(bufnr(''))
+ \ ale_linters#c#clang#GetCommand(bufnr(''), [])
let b:ale_c_clang_executable = 'foobar'
AssertEqual
\ ale#Escape('foobar') . b:command_tail,
- \ ale_linters#c#clang#GetCommand(bufnr(''))
+ \ ale_linters#c#clang#GetCommand(bufnr(''), [])
diff --git a/test/command_callback/test_c_gcc_command_callbacks.vader b/test/command_callback/test_c_gcc_command_callbacks.vader
index 8038f410..3557576e 100644
--- a/test/command_callback/test_c_gcc_command_callbacks.vader
+++ b/test/command_callback/test_c_gcc_command_callbacks.vader
@@ -30,10 +30,10 @@ Execute(The executable should be configurable):
Execute(The executable should be used in the command):
AssertEqual
\ ale#Escape('gcc') . b:command_tail,
- \ ale_linters#c#gcc#GetCommand(bufnr(''))
+ \ ale_linters#c#gcc#GetCommand(bufnr(''), [])
let b:ale_c_gcc_executable = 'foobar'
AssertEqual
\ ale#Escape('foobar') . b:command_tail,
- \ ale_linters#c#gcc#GetCommand(bufnr(''))
+ \ ale_linters#c#gcc#GetCommand(bufnr(''), [])
diff --git a/test/command_callback/test_cpp_clang_command_callbacks.vader b/test/command_callback/test_cpp_clang_command_callbacks.vader
index 67d6898c..8c671115 100644
--- a/test/command_callback/test_cpp_clang_command_callbacks.vader
+++ b/test/command_callback/test_cpp_clang_command_callbacks.vader
@@ -30,10 +30,10 @@ Execute(The executable should be configurable):
Execute(The executable should be used in the command):
AssertEqual
\ ale#Escape('clang++') . b:command_tail,
- \ ale_linters#cpp#clang#GetCommand(bufnr(''))
+ \ ale_linters#cpp#clang#GetCommand(bufnr(''), [])
let b:ale_cpp_clang_executable = 'foobar'
AssertEqual
\ ale#Escape('foobar') . b:command_tail,
- \ ale_linters#cpp#clang#GetCommand(bufnr(''))
+ \ ale_linters#cpp#clang#GetCommand(bufnr(''), [])
diff --git a/test/command_callback/test_cpp_gcc_command_callbacks.vader b/test/command_callback/test_cpp_gcc_command_callbacks.vader
index 9ab4d5cb..7abebf4c 100644
--- a/test/command_callback/test_cpp_gcc_command_callbacks.vader
+++ b/test/command_callback/test_cpp_gcc_command_callbacks.vader
@@ -30,10 +30,10 @@ Execute(The executable should be configurable):
Execute(The executable should be used in the command):
AssertEqual
\ ale#Escape('gcc') . b:command_tail,
- \ ale_linters#cpp#gcc#GetCommand(bufnr(''))
+ \ ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
let b:ale_cpp_gcc_executable = 'foobar'
AssertEqual
\ ale#Escape('foobar') . b:command_tail,
- \ ale_linters#cpp#gcc#GetCommand(bufnr(''))
+ \ ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
diff --git a/test/command_callback/test_gosimple_command_callback.vader b/test/command_callback/test_gosimple_command_callback.vader
new file mode 100644
index 00000000..a0b1f468
--- /dev/null
+++ b/test/command_callback/test_gosimple_command_callback.vader
@@ -0,0 +1,12 @@
+Before:
+ runtime ale_linters/go/gosimple.vim
+ call ale#test#SetFilename('../go_files/testfile2.go')
+
+After:
+ call ale#linter#Reset()
+
+Execute(The default gosimple command should be correct):
+ AssertEqual 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ' gosimple .',
+ \ ale_linters#go#gosimple#GetCommand(bufnr(''))
+
diff --git a/test/command_callback/test_gotype_command_callback.vader b/test/command_callback/test_gotype_command_callback.vader
index f95e8423..4fba3344 100644
--- a/test/command_callback/test_gotype_command_callback.vader
+++ b/test/command_callback/test_gotype_command_callback.vader
@@ -5,15 +5,11 @@ Before:
After:
call ale#linter#Reset()
-
-Execute(The gotype callback should include other files from the directory but exclude the file itself):
- let dir = expand('#' . bufnr('') . ':p:h')
- AssertEqual
- \ "gotype %t ". ale#Escape(ale#path#Simplify(dir . "/testfile.go")),
+Execute(The default gotype command should be correct):
+ AssertEqual 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ' gotype .',
\ ale_linters#go#gotype#GetCommand(bufnr(''))
Execute(The gotype callback should ignore test files):
call ale#test#SetFilename('bla_test.go')
- AssertEqual
- \ 0,
- \ ale_linters#go#gotype#GetCommand(bufnr(''))
+ AssertEqual 0, ale_linters#go#gotype#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_textlint_command_callbacks.vader b/test/command_callback/test_textlint_command_callbacks.vader
new file mode 100644
index 00000000..212f34d3
--- /dev/null
+++ b/test/command_callback/test_textlint_command_callbacks.vader
@@ -0,0 +1,85 @@
+" Author: januswel, w0rp
+
+Before:
+ Save g:ale_textlint_executable
+ Save g:ale_textlint_use_global
+ Save g:ale_textlint_options
+
+ unlet! g:ale_textlint_executable
+ unlet! b:ale_textlint_executable
+ unlet! g:ale_textlint_use_global
+ unlet! b:ale_textlint_use_global
+ unlet! g:ale_textlint_options
+ unlet! b:ale_textlint_options
+
+ runtime autoload/ale/handlers/textlint.vim
+
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+
+After:
+ Restore
+
+ unlet! b:command_tail
+ unlet! b:ale_textlint_executable
+ unlet! b:ale_textlint_use_global
+ unlet! b:ale_textlint_options
+
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+Execute(The executable should be configurable):
+ AssertEqual 'textlint', ale#handlers#textlint#GetExecutable(bufnr(''))
+
+ let b:ale_textlint_executable = 'foobar'
+
+ AssertEqual 'foobar', ale#handlers#textlint#GetExecutable(bufnr(''))
+
+Execute(The executable should be used in the command):
+ AssertEqual
+ \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s',
+ \ ale#handlers#textlint#GetCommand(bufnr(''))
+
+ let b:ale_textlint_executable = 'foobar'
+
+ AssertEqual
+ \ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s',
+ \ ale#handlers#textlint#GetCommand(bufnr(''))
+ \
+
+Execute(The options should be configurable):
+ let b:ale_textlint_options = '--something'
+
+ AssertEqual
+ \ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s',
+ \ ale#handlers#textlint#GetCommand(bufnr(''))
+
+Execute(The local executable from .bin should be used if available):
+ call ale#test#SetFilename('textlint_paths/with_bin_path/foo.txt')
+
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'),
+ \ ale#handlers#textlint#GetExecutable(bufnr(''))
+
+ AssertEqual
+ \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_bin_path/node_modules/.bin/textlint'))
+ \ . ' -f json --stdin --stdin-filename %s',
+ \ ale#handlers#textlint#GetCommand(bufnr(''))
+
+Execute(The local executable from textlint/bin should be used if available):
+ call ale#test#SetFilename('textlint_paths/with_textlint_bin_path/foo.txt')
+
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
+ \ ale#handlers#textlint#GetExecutable(bufnr(''))
+
+ if has('win32')
+ AssertEqual
+ \ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
+ \ . ' -f json --stdin --stdin-filename %s',
+ \ ale#handlers#textlint#GetCommand(bufnr(''))
+ else
+ AssertEqual
+ \ ale#Escape(ale#path#Simplify(g:dir . '/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
+ \ . ' -f json --stdin --stdin-filename %s',
+ \ ale#handlers#textlint#GetCommand(bufnr(''))
+ endif
diff --git a/test/command_callback/test_tslint_command_callback.vader b/test/command_callback/test_tslint_command_callback.vader
index 4ad42fa5..edab72c8 100644
--- a/test/command_callback/test_tslint_command_callback.vader
+++ b/test/command_callback/test_tslint_command_callback.vader
@@ -17,7 +17,10 @@ Before:
After:
Restore
+ unlet! b:ale_typescript_tslint_executable
+ unlet! b:ale_typescript_tslint_config_path
unlet! b:ale_typescript_tslint_rules_dir
+ unlet! b:ale_typescript_tslint_use_global
call ale#test#RestoreDirectory()
call ale#linter#Reset()
@@ -25,7 +28,7 @@ After:
Execute(The default tslint command should be correct):
AssertEqual
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
- \ . 'tslint --format json %t',
+ \ . ale#Escape('tslint') . ' --format json %t',
\ ale_linters#typescript#tslint#GetCommand(bufnr(''))
Execute(The rules directory option should be included if set):
@@ -33,7 +36,16 @@ Execute(The rules directory option should be included if set):
AssertEqual
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
- \ . 'tslint --format json'
+ \ . ale#Escape('tslint') . ' --format json'
\ . ' -r ' . ale#Escape('/foo/bar')
\ . ' %t',
\ ale_linters#typescript#tslint#GetCommand(bufnr(''))
+
+Execute(The executable should be configurable and escaped):
+ let b:ale_typescript_tslint_executable = 'foo bar'
+
+ AssertEqual 'foo bar', ale_linters#typescript#tslint#GetExecutable(bufnr(''))
+ AssertEqual
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . ale#Escape('foo bar') . ' --format json %t',
+ \ ale_linters#typescript#tslint#GetCommand(bufnr(''))
diff --git a/test/command_callback/textlint_paths/with_bin_path/node_modules/.bin/textlint b/test/command_callback/textlint_paths/with_bin_path/node_modules/.bin/textlint
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/textlint_paths/with_bin_path/node_modules/.bin/textlint
diff --git a/test/command_callback/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js b/test/command_callback/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/textlint_paths/with_textlint_bin_path/node_modules/textlint/bin/textlint.js
diff --git a/test/fix/test_ale_fix.vader b/test/fix/test_ale_fix.vader
index 5b66c92c..0321cbae 100644
--- a/test/fix/test_ale_fix.vader
+++ b/test/fix/test_ale_fix.vader
@@ -17,6 +17,14 @@ Before:
\ 'testft': [],
\}
+ let g:pre_success = 0
+ let g:post_success = 0
+ augroup VaderTest
+ autocmd!
+ autocmd User ALEFixPre let g:pre_success = 1
+ autocmd User ALEFixPost let g:post_success = 1
+ augroup end
+
if !has('win32')
let &shell = '/bin/bash'
endif
@@ -171,6 +179,7 @@ After:
unlet! g:ale_emulate_job_failure
unlet! b:ale_fixers
unlet! b:ale_fix_on_save
+ augroup! VaderTest
delfunction AddCarets
delfunction AddDollars
delfunction DoNothing
@@ -664,3 +673,9 @@ Expect(The lines in the JSON should be used):
x
y
z
+
+Execute(ALEFix should apply autocmds):
+ let g:ale_fixers.testft = ['AddCarets']
+ ALEFix
+ AssertEqual g:pre_success, 1
+ AssertEqual g:post_success, 1
diff --git a/test/fixers/test_mix_format_fixer_callback.vader b/test/fixers/test_mix_format_fixer_callback.vader
index c6c97c57..365fbecf 100644
--- a/test/fixers/test_mix_format_fixer_callback.vader
+++ b/test/fixers/test_mix_format_fixer_callback.vader
@@ -1,10 +1,15 @@
Before:
- call ale#test#SetDirectory('/testplugin/test/fixers')
Save g:ale_elixir_mix_executable
+ Save g:ale_elixir_mix_format_options
let g:ale_elixir_mix_executable = 'xxxinvalid'
+ let g:ale_elixir_mix_format_options = ''
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
After:
+ Restore
+
call ale#test#RestoreDirectory()
Execute(The mix_format callback should return the correct default values):
@@ -18,3 +23,14 @@ Execute(The mix_format callback should return the correct default values):
\ },
\ ale#fixers#mix_format#Fix(bufnr(''))
+Execute(The mix_format callback should include the correct format options):
+ let g:ale_elixir_mix_format_options = 'invalid_options'
+ call ale#test#SetFilename('../elixir-test-files/testfile.ex')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' format invalid_options %t',
+ \ },
+ \ ale#fixers#mix_format#Fix(bufnr(''))
diff --git a/test/fixers/test_rufo_fixer_callback.vader b/test/fixers/test_rufo_fixer_callback.vader
new file mode 100644
index 00000000..a0828406
--- /dev/null
+++ b/test/fixers/test_rufo_fixer_callback.vader
@@ -0,0 +1,33 @@
+Before:
+ Save g:ale_ruby_rufo_executable
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_ruby_rufo_executable = 'xxxinvalid'
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+ silent cd ..
+ silent cd command_callback
+ let g:dir = getcwd()
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The rufo command should contain `bundle exec` when executable is `bundle`):
+ let g:ale_ruby_rufo_executable = 'bundle'
+ call ale#test#SetFilename('ruby_paths/dummy.rb')
+
+ AssertEqual
+ \ ale#Escape('bundle') . ' exec rufo %t',
+ \ ale#fixers#rufo#GetCommand(bufnr(''))
+
+Execute(The rufo callback should return the correct default values):
+ call ale#test#SetFilename('ruby_paths/dummy.rb')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid') . ' %t'
+ \ },
+ \ ale#fixers#rufo#Fix(bufnr(''))
diff --git a/test/handler/test_fish_handler.vader b/test/handler/test_fish_handler.vader
index 567952e4..ad3a963c 100644
--- a/test/handler/test_fish_handler.vader
+++ b/test/handler/test_fish_handler.vader
@@ -37,3 +37,25 @@ Execute(The fish handler should handle basic warnings and syntax errors):
\ "abbr --add p 'cd ~/Projects'",
\ '^',
\ ])
+
+Execute(The fish handler should handle problems where the problem before before the line with the line number):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 2,
+ \ 'col': 23,
+ \ 'text': 'Unsupported use of ''||''. In fish, please use ''COMMAND; or COMMAND''.',
+ \ },
+ \ {
+ \ 'lnum': 5,
+ \ 'col': 1,
+ \ 'text': 'wat',
+ \ },
+ \ ],
+ \ ale_linters#fish#fish#Handle(bufnr(''), [
+ \ 'Unsupported use of ''||''. In fish, please use ''COMMAND; or COMMAND''.',
+ \ '/tmp/vLz620o/258/test.fish (line 2): if set -q SSH_CLIENT || set -q SSH_TTY',
+ \ ' ^',
+ \ '/tmp/vLz620o/258/test.fish (line 5): wat',
+ \ ' ^',
+ \ ])
diff --git a/test/handler/test_govet_handler.vader b/test/handler/test_go_generic_handler.vader
index b4bfdc93..624e56c1 100644
--- a/test/handler/test_govet_handler.vader
+++ b/test/handler/test_go_generic_handler.vader
@@ -1,10 +1,4 @@
-Before:
- runtime ale_linters/go/govet.vim
-
-After:
- call ale#linter#Reset()
-
-Execute(The govet handler should return the correct filenames):
+Execute(The golang handler should return the correct filenames):
AssertEqual
\ [
\ {
@@ -22,7 +16,7 @@ Execute(The govet handler should return the correct filenames):
\ 'filename': ale#path#Simplify(expand('%:p:h') . '/other.go'),
\ },
\ ],
- \ ale_linters#go#govet#Handler(bufnr(''), [
+ \ ale#handlers#go#Handler(bufnr(''), [
\ 'test.go:27: some error',
\ 'other.go:27:5: some error with a column',
\ ])
diff --git a/test/handler/test_markdownlint_handler.vader b/test/handler/test_markdownlint_handler.vader
new file mode 100644
index 00000000..db6acc66
--- /dev/null
+++ b/test/handler/test_markdownlint_handler.vader
@@ -0,0 +1,24 @@
+Before:
+ runtime ale_linters/markdown/markdownlint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The Markdownlint handler should parse output correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'text': '(MD002/first-header-h1) First header should be a top level header [Expected: h1; Actual: h2]',
+ \ 'type': 'W'
+ \ },
+ \ {
+ \ 'lnum': 298,
+ \ 'text': '(MD033/no-inline-html) Inline HTML [Element: p]',
+ \ 'type': 'W'
+ \ }
+ \ ],
+ \ ale#handlers#markdownlint#Handle(0, [
+ \ 'README.md: 1: MD002/first-header-h1 First header should be a top level header [Expected: h1; Actual: h2]',
+ \ 'README.md: 298: MD033/no-inline-html Inline HTML [Element: p]'
+ \ ])
diff --git a/test/handler/test_qmllint_handler.vader b/test/handler/test_qmllint_handler.vader
new file mode 100644
index 00000000..fcc65eb5
--- /dev/null
+++ b/test/handler/test_qmllint_handler.vader
@@ -0,0 +1,19 @@
+Before:
+ runtime ale_linters/qml/qmllint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The qmllint handler should parse error messages correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 2,
+ \ 'col': 0,
+ \ 'type': 'E',
+ \ 'text': 'Expected token ''}'''
+ \ }
+ \ ],
+ \ ale_linters#qml#qmllint#Handle(1, [
+ \ '/tmp/ab34cd56/Test.qml:2 : Expected token ''}'''
+ \ ])
diff --git a/test/handler/test_redpen_handler.vader b/test/handler/test_redpen_handler.vader
index f28d6923..4490bcba 100644
--- a/test/handler/test_redpen_handler.vader
+++ b/test/handler/test_redpen_handler.vader
@@ -23,6 +23,15 @@ Execute(redpen handler should handle errors output):
\ 'type': 'W',
\ 'code': 'Spelling',
\ },
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 35,
+ \ 'end_lnum': 1,
+ \ 'end_col': 55,
+ \ 'text': 'Found possibly misspelled word "コードチェック".',
+ \ 'type': 'W',
+ \ 'code': 'Spelling',
+ \ },
\ ],
\ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [
\ '[',
@@ -50,6 +59,21 @@ Execute(redpen handler should handle errors output):
\ ' "lineNum": 1,',
\ ' "sentenceStartColumnNum": 0,',
\ ' "message": "Found possibly misspelled word \"NeoVim\"."',
+ \ ' },',
+ \ ' {',
+ \ ' "sentence": "ALEはNeoVimとVim8で非同期のコードチェックを実現するプラグインです。",',
+ \ ' "endPosition": {',
+ \ ' "offset": 27,',
+ \ ' "lineNum": 1',
+ \ ' },',
+ \ ' "validator": "Spelling",',
+ \ ' "lineNum": 1,',
+ \ ' "sentenceStartColumnNum": 0,',
+ \ ' "message": "Found possibly misspelled word \"コードチェック\".",',
+ \ ' "startPosition": {',
+ \ ' "offset": 20,',
+ \ ' "lineNum": 1',
+ \ ' }',
\ ' }',
\ ' ]',
\ ' }',
diff --git a/test/handler/test_remark_lint_handler.vader b/test/handler/test_remark_lint_handler.vader
index f61da199..0794d51c 100644
--- a/test/handler/test_remark_lint_handler.vader
+++ b/test/handler/test_remark_lint_handler.vader
@@ -19,12 +19,21 @@ Execute(Warning and error messages should be handled correctly):
\ 'type': 'E',
\ 'text': 'Incorrect list-item indent: remove 1 space list-item-indent remark-lint',
\ },
+ \ {
+ \ 'lnum': 18,
+ \ 'col': 71,
+ \ 'end_lnum': 19,
+ \ 'end_col': 1,
+ \ 'type': 'E',
+ \ 'text': 'Missing new line after list item list-item-spacing remark-lint',
+ \ },
\ ],
\ ale_linters#markdown#remark_lint#Handle(1, [
\ 'foo.md',
\ ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint',
\ ' 3:5 error Incorrect list-item indent: remove 1 space list-item-indent remark-lint',
+ \ ' 18:71-19:1 error Missing new line after list item list-item-spacing remark-lint',
\ '',
\ '⚠ 1 warnings',
- \ '✘ 1 errors',
+ \ '✘ 2 errors',
\])
diff --git a/test/handler/test_textlint_handler.vader b/test/handler/test_textlint_handler.vader
new file mode 100644
index 00000000..c00d54de
--- /dev/null
+++ b/test/handler/test_textlint_handler.vader
@@ -0,0 +1,41 @@
+Before:
+ runtime! ale_linters/markdown/textlint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(textlint handler should handle errors output):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 16,
+ \ 'col': 50,
+ \ 'text': 'Found possibly misspelled word "NeoVim".',
+ \ 'type': 'W',
+ \ 'code': 'preset-japanese/no-doubled-joshi',
+ \ },
+ \ ],
+ \ ale#handlers#textlint#HandleTextlintOutput(bufnr(''), [
+ \ '[',
+ \ ' {',
+ \ ' "filePath": "test.md",',
+ \ ' "messages": [',
+ \ ' {',
+ \ ' "type": "lint",',
+ \ ' "ruleId": "preset-japanese/no-doubled-joshi",',
+ \ ' "index": 1332,',
+ \ ' "line": 16,',
+ \ ' "column": 50,',
+ \ ' "severity": 2,',
+ \ ' "message": "Found possibly misspelled word \"NeoVim\"."',
+ \ ' }',
+ \ ' ]',
+ \ ' }',
+ \ ']',
+ \ ])
+
+Execute(textlint handler should no error output):
+ AssertEqual
+ \ [],
+ \ ale#handlers#textlint#HandleTextlintOutput(bufnr(''), [
+ \ ])
diff --git a/test/test_ale_toggle.vader b/test/test_ale_toggle.vader
index d56f8c2b..ca8b25d5 100644
--- a/test/test_ale_toggle.vader
+++ b/test/test_ale_toggle.vader
@@ -5,12 +5,14 @@ Before:
Save g:ale_run_synchronously
Save g:ale_pattern_options
Save g:ale_pattern_options_enabled
+ Save g:ale_set_balloons
let g:ale_set_signs = 1
let g:ale_set_lists_synchronously = 1
let g:ale_run_synchronously = 1
let g:ale_pattern_options = {}
let g:ale_pattern_options_enabled = 1
+ let g:ale_set_balloons = has('balloon_eval')
unlet! b:ale_enabled
@@ -344,3 +346,41 @@ Execute(ALEResetBuffer should reset everything for a buffer):
AssertEqual 1, g:ale_enabled
AssertEqual 1, get(b:, 'ale_enabled', 1)
+
+Execute(Disabling ALE should disable balloons):
+ " These tests won't run in the console, but we can run them manually in GVim.
+ if has('balloon_eval')
+ call ale#linter#Reset()
+
+ " Enable balloons, so we can check the expr value.
+ call ale#balloon#Enable()
+
+ AssertEqual 1, &ballooneval
+ AssertEqual 'ale#balloon#Expr()', &balloonexpr
+
+ " Toggle ALE off.
+ ALEToggle
+
+ " The balloon settings should be reset.
+ AssertEqual 0, &ballooneval
+ AssertEqual '', &balloonexpr
+ endif
+
+Execute(Enabling ALE should enable balloons if the setting is on):
+ if has('balloon_eval')
+ call ale#linter#Reset()
+ call ale#balloon#Disable()
+ ALEDisable
+ let g:ale_set_balloons = 0
+ ALEEnable
+
+ AssertEqual 0, &ballooneval
+ AssertEqual '', &balloonexpr
+
+ ALEDisable
+ let g:ale_set_balloons = 1
+ ALEEnable
+
+ AssertEqual 1, &ballooneval
+ AssertEqual 'ale#balloon#Expr()', &balloonexpr
+ endif
diff --git a/test/test_balloon_messages.vader b/test/test_balloon_messages.vader
index ec09fe29..8f4415ae 100644
--- a/test/test_balloon_messages.vader
+++ b/test/test_balloon_messages.vader
@@ -1,21 +1,25 @@
Before:
Save g:ale_buffer_info
+ Save g:ale_enabled
+ Save g:ale_set_balloons
- let g:ale_buffer_info[347] = {'loclist': [
+ let g:ale_set_balloons = 1
+
+ let g:ale_buffer_info[bufnr('')] = {'loclist': [
\ {
- \ 'bufnr': 347,
+ \ 'bufnr': bufnr(''),
\ 'lnum': 1,
\ 'col': 10,
\ 'text': 'Missing semicolon. (semi)',
\ },
\ {
- \ 'bufnr': 347,
+ \ 'bufnr': bufnr(''),
\ 'lnum': 2,
\ 'col': 10,
\ 'text': 'Infix operators must be spaced. (space-infix-ops)'
\ },
\ {
- \ 'bufnr': 347,
+ \ 'bufnr': bufnr(''),
\ 'lnum': 2,
\ 'col': 15,
\ 'text': 'Missing radix parameter (radix)'
@@ -25,17 +29,50 @@ Before:
After:
Restore
+ unlet! b:ale_enabled
+ unlet! b:ale_set_balloons
+
Execute(Balloon messages should be shown for the correct lines):
AssertEqual
\ 'Missing semicolon. (semi)',
- \ ale#balloon#MessageForPos(347, 1, 1)
+ \ ale#balloon#MessageForPos(bufnr(''), 1, 1)
Execute(Balloon messages should be shown for earlier columns):
AssertEqual
\ 'Infix operators must be spaced. (space-infix-ops)',
- \ ale#balloon#MessageForPos(347, 2, 1)
+ \ ale#balloon#MessageForPos(bufnr(''), 2, 1)
Execute(Balloon messages should be shown for later columns):
AssertEqual
\ 'Missing radix parameter (radix)',
- \ ale#balloon#MessageForPos(347, 2, 16)
+ \ ale#balloon#MessageForPos(bufnr(''), 2, 16)
+
+Execute(Balloon messages should be disabled if ALE is disabled globally):
+ let g:ale_enabled = 0
+ " Enabling the buffer should not make a difference.
+ let b:ale_enabled = 1
+
+ AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1)
+
+Execute(Balloon messages should be disabled if ALE is disabled for a buffer):
+ let b:ale_enabled = 0
+
+ AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1)
+
+Execute(Balloon messages should be disabled if the global setting is off):
+ let g:ale_set_balloons = 0
+
+ AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1)
+
+Execute(Balloon messages should be disabled if the buffer setting is off):
+ let b:ale_set_balloons = 0
+
+ AssertEqual '', ale#balloon#MessageForPos(bufnr(''), 1, 1)
+
+Execute(The balloon buffer setting should override the global one):
+ let g:ale_set_balloons = 0
+ let b:ale_set_balloons = 1
+
+ AssertEqual
+ \ 'Missing semicolon. (semi)',
+ \ ale#balloon#MessageForPos(bufnr(''), 1, 1)
diff --git a/test/test_c_import_paths.vader b/test/test_c_import_paths.vader
index 6080779f..f2a06781 100644
--- a/test/test_c_import_paths.vader
+++ b/test/test_c_import_paths.vader
@@ -42,7 +42,7 @@ Execute(The C GCC handler should include 'include' directories for projects with
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/include')) . ' '
\ . ' -'
- \ , ale_linters#c#gcc#GetCommand(bufnr(''))
+ \ , ale_linters#c#gcc#GetCommand(bufnr(''), [])
Execute(The C GCC handler should include 'include' directories for projects with a configure file):
runtime! ale_linters/c/gcc.vim
@@ -55,7 +55,7 @@ Execute(The C GCC handler should include 'include' directories for projects with
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/include')) . ' '
\ . ' -'
- \ , ale_linters#c#gcc#GetCommand(bufnr(''))
+ \ , ale_linters#c#gcc#GetCommand(bufnr(''), [])
Execute(The C GCC handler should include root directories for projects with .h files in them):
runtime! ale_linters/c/gcc.vim
@@ -68,7 +68,7 @@ Execute(The C GCC handler should include root directories for projects with .h f
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
- \ , ale_linters#c#gcc#GetCommand(bufnr(''))
+ \ , ale_linters#c#gcc#GetCommand(bufnr(''), [])
Execute(The C GCC handler should include root directories for projects with .hpp files in them):
runtime! ale_linters/c/gcc.vim
@@ -81,7 +81,7 @@ Execute(The C GCC handler should include root directories for projects with .hpp
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
- \ , ale_linters#c#gcc#GetCommand(bufnr(''))
+ \ , ale_linters#c#gcc#GetCommand(bufnr(''), [])
Execute(The C Clang handler should include 'include' directories for projects with a Makefile):
runtime! ale_linters/c/clang.vim
@@ -94,7 +94,7 @@ Execute(The C Clang handler should include 'include' directories for projects wi
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/include')) . ' '
\ . ' -'
- \ , ale_linters#c#clang#GetCommand(bufnr(''))
+ \ , ale_linters#c#clang#GetCommand(bufnr(''), [])
Execute(The C Clang handler should include 'include' directories for projects with a configure file):
runtime! ale_linters/c/clang.vim
@@ -107,7 +107,7 @@ Execute(The C Clang handler should include 'include' directories for projects wi
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
- \ , ale_linters#c#clang#GetCommand(bufnr(''))
+ \ , ale_linters#c#clang#GetCommand(bufnr(''), [])
Execute(The C Clang handler should include root directories for projects with .h files in them):
runtime! ale_linters/c/clang.vim
@@ -120,7 +120,7 @@ Execute(The C Clang handler should include root directories for projects with .h
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
- \ , ale_linters#c#clang#GetCommand(bufnr(''))
+ \ , ale_linters#c#clang#GetCommand(bufnr(''), [])
Execute(The C Clang handler should include root directories for projects with .hpp files in them):
runtime! ale_linters/c/clang.vim
@@ -133,7 +133,7 @@ Execute(The C Clang handler should include root directories for projects with .h
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
- \ , ale_linters#c#clang#GetCommand(bufnr(''))
+ \ , ale_linters#c#clang#GetCommand(bufnr(''), [])
Execute(The C++ GCC handler should include 'include' directories for projects with a Makefile):
runtime! ale_linters/cpp/gcc.vim
@@ -146,7 +146,7 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/include')) . ' '
\ . ' -'
- \ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
+ \ , ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
Execute(The C++ GCC handler should include 'include' directories for projects with a configure file):
runtime! ale_linters/cpp/gcc.vim
@@ -159,7 +159,7 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/include')) . ' '
\ . ' -'
- \ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
+ \ , ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
Execute(The C++ GCC handler should include root directories for projects with .h files in them):
runtime! ale_linters/cpp/gcc.vim
@@ -172,7 +172,7 @@ Execute(The C++ GCC handler should include root directories for projects with .h
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
- \ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
+ \ , ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
Execute(The C++ GCC handler should include root directories for projects with .hpp files in them):
runtime! ale_linters/cpp/gcc.vim
@@ -185,7 +185,7 @@ Execute(The C++ GCC handler should include root directories for projects with .h
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
- \ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
+ \ , ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
Execute(The C++ Clang handler should include 'include' directories for projects with a Makefile):
runtime! ale_linters/cpp/clang.vim
@@ -198,7 +198,7 @@ Execute(The C++ Clang handler should include 'include' directories for projects
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/include')) . ' '
\ . ' -'
- \ , ale_linters#cpp#clang#GetCommand(bufnr(''))
+ \ , ale_linters#cpp#clang#GetCommand(bufnr(''), [])
Execute(The C++ Clang handler should include 'include' directories for projects with a configure file):
runtime! ale_linters/cpp/clang.vim
@@ -211,7 +211,7 @@ Execute(The C++ Clang handler should include 'include' directories for projects
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/configure_project/include')) . ' '
\ . ' -'
- \ , ale_linters#cpp#clang#GetCommand(bufnr(''))
+ \ , ale_linters#cpp#clang#GetCommand(bufnr(''), [])
Execute(The C++ Clang handler should include root directories for projects with .h files in them):
runtime! ale_linters/cpp/clang.vim
@@ -224,7 +224,7 @@ Execute(The C++ Clang handler should include root directories for projects with
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
- \ , ale_linters#cpp#clang#GetCommand(bufnr(''))
+ \ , ale_linters#cpp#clang#GetCommand(bufnr(''), [])
Execute(The C++ Clang handler should include root directories for projects with .hpp files in them):
runtime! ale_linters/cpp/clang.vim
@@ -237,7 +237,7 @@ Execute(The C++ Clang handler should include root directories for projects with
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
- \ , ale_linters#cpp#clang#GetCommand(bufnr(''))
+ \ , ale_linters#cpp#clang#GetCommand(bufnr(''), [])
Execute(The C++ Clang handler shoud use the include directory based on the .git location):
runtime! ale_linters/cpp/clang.vim
@@ -258,7 +258,7 @@ Execute(The C++ Clang handler shoud use the include directory based on the .git
\ . '-iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/git_and_nested_makefiles/src')) . ' '
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/git_and_nested_makefiles/include')) . ' '
\ . ' -'
- \ , ale_linters#cpp#clang#GetCommand(bufnr(''))
+ \ , ale_linters#cpp#clang#GetCommand(bufnr(''), [])
Execute(The C++ ClangTidy handler should include json folders for projects with suitable build directory in them):
runtime! ale_linters/cpp/clangtidy.vim
diff --git a/test/test_c_parse_makefile.vader b/test/test_c_parse_makefile.vader
new file mode 100644
index 00000000..7c2fc21e
--- /dev/null
+++ b/test/test_c_parse_makefile.vader
@@ -0,0 +1,184 @@
+Before:
+ Save g:ale_c_parse_makefile
+ Save g:ale_c_gcc_options
+ Save g:ale_c_clang_options
+ Save g:ale_cpp_gcc_options
+ Save g:ale_cpp_clang_options
+
+ call ale#test#SetDirectory('/testplugin/test')
+
+ let g:ale_c_parse_makefile=1
+ let g:ale_c_gcc_options = ''
+ let g:ale_c_clang_options = ''
+ let g:ale_cpp_gcc_options = ''
+ let g:ale_cpp_clang_options = ''
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+Execute(The CFlags parser should be able to parse include directives):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ [ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))]
+ \ , ale#c#ParseCFlags(bufnr(''), 'gcc -Isubdir -c file.c')
+
+Execute(The CFlags parser should be able to parse macro directives):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ [ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ '-DTEST=1']
+ \ , ale#c#ParseCFlags(bufnr(''), 'gcc -Isubdir -DTEST=1 -c file.c')
+
+Execute(The CFlags parser should be able to parse macro directives with spaces):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ [ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ '-DTEST=$(( 2 * 4 ))']
+ \ , ale#c#ParseCFlags(bufnr(''), 'gcc -Isubdir -DTEST=$(( 2 * 4 )) -c file.c')
+
+Execute(The CFlags parser should be able to parse shell directives with spaces):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ [ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ '-DTEST=`date +%s`']
+ \ , ale#c#ParseCFlags(bufnr(''), 'gcc -Isubdir -DTEST=`date +%s` -c file.c')
+
+Execute(The CFlagsToList parser should be able to parse multiple cflags):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ [ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ '-DTEST=`date +%s`']
+ \ , ale#c#ParseCFlagsToList(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ split('gcc -Isubdir -DTEST=`date +%s` -c file.c', '-'))
+
+Execute(The CFlagsToList parser should be able to parse multiple cflags #2):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ [ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
+ \ '-DTEST=`date +%s`']
+ \ , ale#c#ParseCFlagsToList(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ split('gcc -Isubdir ' .
+ \ '-I'. ale#path#Simplify('kernel/include') .
+ \ ' -DTEST=`date +%s` -c file.c', '-'))
+
+Execute(The CFlagsToList parser should be able to parse multiple cflags #3):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ ['-Dgoal=9',
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
+ \ '-DTEST=`date +%s`']
+ \ , ale#c#ParseCFlagsToList(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ split('gcc -Dgoal=9 -Isubdir ' .
+ \ '-I'. ale#path#Simplify('kernel/include') .
+ \ ' -DTEST=`date +%s` -c file.c', '-'))
+
+Execute(The CFlagsToList parser should be able to parse multiple cflags #4):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ ['-Dgoal=9',
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
+ \ '-DTEST=`date +%s`']
+ \ , ale#c#ParseCFlagsToList(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ split('gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' .
+ \ '-I'. ale#path#Simplify('kernel/include') .
+ \ ' -DTEST=`date +%s` -c file.c', '-'))
+
+Execute(The CFlagsToList parser should be able to parse multiple cflags #5):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ ['-Dgoal=9',
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
+ \ '-DTEST=`date +%s`']
+ \ , ale#c#ParseCFlagsToList(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ split('gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' .
+ \ '-I"dir with spaces"' . ' -I'. ale#path#Simplify('kernel/include') .
+ \ ' -DTEST=`date +%s` -c file.c', '-'))
+
+Execute(The CFlagsToList parser should be able to parse multiple cflags #6):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ ['-Dgoal=9',
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
+ \ '-DTEST=`date +%s`']
+ \ , ale#c#ParseCFlagsToList(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ split('gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' .
+ \ '-I''dir with spaces''' . ' -I'. ale#path#Simplify('kernel/include') .
+ \ ' -DTEST=`date +%s` -c file.c', '-'))
+
+Execute(The CFlagsToList parser should be able to parse multiple cflags #7):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ ['-Dgoal=9',
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
+ \ '-DTEST=`date +%s`']
+ \ , ale#c#ParseCFlagsToList(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ split('gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' .
+ \ '-I''dir with spaces''' . ' -Idir-with-dash' .
+ \ ' -I'. ale#path#Simplify('kernel/include') .
+ \ ' -DTEST=`date +%s` -c file.c', '-'))
+
+Execute(The CFlagsToList parser should be able to parse multiple cflags #8):
+ runtime! ale_linters/c/gcc.vim
+
+ call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
+
+ AssertEqual
+ \ ['-Dgoal=9',
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
+ \ '-Dmacro-with-dash',
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash')),
+ \ ale#Escape('-I' . ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
+ \ '-DTEST=`date +%s`']
+ \ , ale#c#ParseCFlagsToList(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
+ \ split('gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir ' .
+ \ '-Dmacro-with-dash ' .
+ \ '-I''dir with spaces''' . ' -Idir-with-dash' .
+ \ ' -I'. ale#path#Simplify('kernel/include') .
+ \ ' -DTEST=`date +%s` -c file.c', '-'))
diff --git a/test/test_c_projects/makefile_project/subdir/file.c b/test/test_c_projects/makefile_project/subdir/file.c
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/test_c_projects/makefile_project/subdir/file.c
diff --git a/test/test_loclist_corrections.vader b/test/test_loclist_corrections.vader
index 6224d608..46c7e272 100644
--- a/test/test_loclist_corrections.vader
+++ b/test/test_loclist_corrections.vader
@@ -324,7 +324,7 @@ Execute(FixLocList should interpret temporary filenames as being the current buf
\ 'foobar',
\ [
\ {'text': 'a', 'lnum': 2, 'filename': b:temp_name},
- \ {'text': 'a', 'lnum': 3, 'filename': b:temp_name},
+ \ {'text': 'a', 'lnum': 3, 'filename': substitute(b:temp_name, '\\', '/', 'g')},
\ ],
\ )