summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorØyvind Ingvaldsen <oyvind.ingvaldsen@gmail.com>2018-05-04 21:44:32 +0200
committerØyvind Ingvaldsen <oyvind.ingvaldsen@gmail.com>2018-05-04 21:44:32 +0200
commit27144eee8c5fbfc03578569067adeaf19c3d009d (patch)
tree0cdd7bc2318ca68054970ad4cdffb046af287543 /test
parent726a768464d3e42869088599cf1bd049f7a751df (diff)
downloadale-27144eee8c5fbfc03578569067adeaf19c3d009d.zip
Added NASM linter
Added NASM linter (for nasm filetype).
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_nasm_nasm_command_callbacks.vader52
-rw-r--r--test/handler/test_nasm_handler.vader30
2 files changed, 82 insertions, 0 deletions
diff --git a/test/command_callback/test_nasm_nasm_command_callbacks.vader b/test/command_callback/test_nasm_nasm_command_callbacks.vader
new file mode 100644
index 00000000..01a574c8
--- /dev/null
+++ b/test/command_callback/test_nasm_nasm_command_callbacks.vader
@@ -0,0 +1,52 @@
+Before:
+ Save g:ale_nasm_nasm_executable
+ Save g:ale_nasm_nasm_options
+
+ unlet! g:ale_nasm_nasm_executable
+ unlet! b:ale_nasm_nasm_executable
+ unlet! g:ale_nasm_nasm_options
+ unlet! b:ale_nasm_nasm_options
+
+ runtime ale_linters/nasm/nasm.vim
+
+ let b:command_tail =
+ \ ' -X gnu -I ' . ale#Escape(getcwd() . '/') . ' %s'
+ let b:command_tail_opt =
+ \ ' -X gnu -I ' . ale#Escape(getcwd() . '/') . ' -w+orphan-labels %s'
+
+After:
+ Restore
+ unlet! b:command_tail
+ unlet! b:command_tail_opt
+ unlet! b:ale_nasm_nasm_executable
+ unlet! b:ale_nasm_nasm_options
+ call ale#linter#Reset()
+
+Execute(The executable should be configurable):
+ AssertEqual 'nasm', ale_linters#nasm#nasm#GetExecutable(bufnr(''))
+
+ let b:ale_nasm_nasm_executable = '/opt/nasm/nasm'
+
+ AssertEqual '/opt/nasm/nasm', ale_linters#nasm#nasm#GetExecutable(bufnr(''))
+
+Execute(The executable should be used in the command):
+ AssertEqual
+ \ ale#Escape('nasm') . b:command_tail,
+ \ ale_linters#nasm#nasm#GetCommand(bufnr(''))
+
+ let b:ale_nasm_nasm_executable = '~/nasm'
+
+ AssertEqual
+ \ ale#Escape('~/nasm') . b:command_tail,
+ \ ale_linters#nasm#nasm#GetCommand(bufnr(''))
+
+Execute(The options should be configurable):
+ AssertEqual '', ale_linters#nasm#nasm#GetOptions(bufnr(''))
+ let b:ale_nasm_nasm_options = '-w-macro-params'
+ AssertEqual '-w-macro-params', ale_linters#nasm#nasm#GetOptions(bufnr(''))
+
+Execute(The options should be used in command):
+ let b:ale_nasm_nasm_options = '-w+orphan-labels'
+ AssertEqual
+ \ ale#Escape('nasm') . b:command_tail_opt,
+ \ ale_linters#nasm#nasm#GetCommand(bufnr(''))
diff --git a/test/handler/test_nasm_handler.vader b/test/handler/test_nasm_handler.vader
new file mode 100644
index 00000000..95b8fefd
--- /dev/null
+++ b/test/handler/test_nasm_handler.vader
@@ -0,0 +1,30 @@
+Before:
+ runtime ale_linters/nasm/nasm.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The nasm handler should parse GCC style output from nasm correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 2,
+ \ 'text': "label alone on a line without a colon might be in error",
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 4,
+ \ 'text': "invalid combination of opcode and operands",
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 7,
+ \ 'text': "unable to open include file `bar.asm'",
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#nasm#nasm#Handle(357, [
+ \ "tmp.asm:2: warning: label alone on a line without a colon might be in error",
+ \ "tmp.asm:4: error: invalid combination of opcode and operands",
+ \ "tmp.asm:7: fatal: unable to open include file `bar.asm'"
+ \ ])