summaryrefslogtreecommitdiff
path: root/test/command_callback/test_llc_command_callback.vader
diff options
context:
space:
mode:
authorLinda_pp <rhysd@users.noreply.github.com>2017-10-10 18:13:09 +0900
committerw0rp <w0rp@users.noreply.github.com>2017-10-10 10:13:09 +0100
commit70177480ba1f9968409709442fc4be4e9a69d564 (patch)
treeea1971f3903f98831d4868e2ef2f54a3c79064a9 /test/command_callback/test_llc_command_callback.vader
parenta809c4fa3a781af7401d2f11ee5155caef081457 (diff)
downloadale-70177480ba1f9968409709442fc4be4e9a69d564.zip
Add llc integration for LLVM IR (#979)
Check LLVM IR with llc
Diffstat (limited to 'test/command_callback/test_llc_command_callback.vader')
-rw-r--r--test/command_callback/test_llc_command_callback.vader39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/command_callback/test_llc_command_callback.vader b/test/command_callback/test_llc_command_callback.vader
new file mode 100644
index 00000000..296b277a
--- /dev/null
+++ b/test/command_callback/test_llc_command_callback.vader
@@ -0,0 +1,39 @@
+Before:
+ Save g:ale_llvm_llc_executable
+
+ unlet! g:ale_llvm_llc_executable
+ unlet! b:ale_llvm_llc_executable
+
+ runtime ale_linters/llvm/llc.vim
+
+ function! AssertHasPrefix(str, prefix) abort
+ let msg = printf("'%s' is expected to be prefixed with '%s'", a:str, a:prefix)
+ AssertEqual stridx(a:str, a:prefix), 0, msg
+ endfunction
+
+After:
+ unlet! g:ale_llvm_llc_executable
+ unlet! b:ale_llvm_llc_executable
+ delfunction AssertHasPrefix
+ Restore
+
+Execute(llc command is customizable):
+ let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
+ call AssertHasPrefix(cmd, ale#Escape('llc'))
+
+ let g:ale_llvm_llc_executable = 'llc-5.0'
+ let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
+ call AssertHasPrefix(cmd, ale#Escape('llc-5.0'))
+
+ let b:ale_llvm_llc_executable = 'llc-4.0'
+ let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
+ call AssertHasPrefix(cmd, ale#Escape('llc-4.0'))
+
+Execute(GetCommand() escapes the returned path):
+ let b:ale_llvm_llc_executable = '/path/space contained/llc'
+ let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
+ call AssertHasPrefix(cmd, ale#Escape('/path/space contained/llc'))
+
+Execute(GetExecutable() does not escape the returned path):
+ let b:ale_llvm_llc_executable = '/path/space contained/llc'
+ AssertEqual ale_linters#llvm#llc#GetExecutable(bufnr('')), '/path/space contained/llc'