summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_ada_gcc_command_callbacks.vader44
-rw-r--r--test/handler/test_ada_gcc_handler.vader36
2 files changed, 80 insertions, 0 deletions
diff --git a/test/command_callback/test_ada_gcc_command_callbacks.vader b/test/command_callback/test_ada_gcc_command_callbacks.vader
new file mode 100644
index 00000000..de6e355e
--- /dev/null
+++ b/test/command_callback/test_ada_gcc_command_callbacks.vader
@@ -0,0 +1,44 @@
+Before:
+ call ale#assert#SetUpLinterTest('ada', 'gcc')
+ call ale#test#SetFilename('dummy.adb')
+
+ function! GetOutputDir(command) abort
+ let l:split_command = split(a:command)
+ let l:index = index(l:split_command, '-o')
+ return l:split_command[l:index + 1]
+ endfunction
+
+ let b:out_file = GetOutputDir(ale_linters#ada#gcc#GetCommand(bufnr('')))
+
+After:
+ delfunction GetOutputDir
+
+ unlet! b:out_file
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(The executable should be configurable):
+
+ AssertLinter 'gcc',
+ \ ale#Escape('gcc') . ' -x ada -c -gnatc'
+ \ . ' -o ' . b:out_file
+ \ . ' -I ' . ale#Escape(getcwd())
+ \ . ' -gnatwa -gnatq %t'
+
+ let b:ale_ada_gcc_executable = 'foo'
+
+ AssertLinter 'foo',
+ \ ale#Escape('foo') . ' -x ada -c -gnatc'
+ \ . ' -o ' . b:out_file
+ \ . ' -I ' . ale#Escape(getcwd())
+ \ . ' -gnatwa -gnatq %t'
+
+Execute(The options should be configurable):
+
+ let g:ale_ada_gcc_options = '--foo --bar'
+
+ AssertLinter 'gcc',
+ \ ale#Escape('gcc') . ' -x ada -c -gnatc'
+ \ . ' -o ' . b:out_file
+ \ . ' -I ' . ale#Escape(getcwd())
+ \ . ' --foo --bar %t'
diff --git a/test/handler/test_ada_gcc_handler.vader b/test/handler/test_ada_gcc_handler.vader
new file mode 100644
index 00000000..06ddfe1f
--- /dev/null
+++ b/test/handler/test_ada_gcc_handler.vader
@@ -0,0 +1,36 @@
+Before:
+ runtime ale_linters/ada/gcc.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The gcc handler for Ada should parse input correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 8,
+ \ 'col': 5,
+ \ 'type': 'W',
+ \ 'text': 'variable "X" is assigned but never read',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 6,
+ \ 'col': 22,
+ \ 'type': 'E',
+ \ 'text': 'type definition expected',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 8,
+ \ 'col': 9,
+ \ 'type': 'E',
+ \ 'text': 'aspect specifications not allowed here',
+ \ },
+ \ ],
+ \ ale_linters#ada#gcc#Handle(0, [
+ \ 'foobar.adb:8:05: warning: variable "X" is assigned but never read',
+ \ 'foobar.ads:6:22: type definition expected',
+ \ 'foobar.ads:8:09: aspect specifications not allowed here',
+ \ ])