summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-12-19 18:10:29 +0000
committerw0rp <devw0rp@gmail.com>2017-12-19 18:10:29 +0000
commit73f61514c9039e7e863da3544f251d3f8d7d1956 (patch)
tree56a8b2160ef4d8b3e82a5349332af5bf6c95caa0 /test
parentcc8e5502c8fd9d0d2ba405214e05f90b4152e2b2 (diff)
downloadale-73f61514c9039e7e863da3544f251d3f8d7d1956.zip
Fix #1031 - Make the rust flags configurable
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_rustc_command_callback.vader37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/command_callback/test_rustc_command_callback.vader b/test/command_callback/test_rustc_command_callback.vader
new file mode 100644
index 00000000..fe46c9ad
--- /dev/null
+++ b/test/command_callback/test_rustc_command_callback.vader
@@ -0,0 +1,37 @@
+Before:
+ Save g:ale_rust_rustc_options
+
+ unlet! g:ale_rust_rustc_options
+
+ runtime ale_linters/rust/rustc.vim
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+
+After:
+ Restore
+
+ unlet! b:ale_rust_rustc_options
+
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+Execute(The default command should be correct):
+ AssertEqual
+ \ 'rustc --error-format=json -Z no-trans -',
+ \ ale_linters#rust#rustc#RustcCommand(bufnr(''))
+
+Execute(The options should be configurable):
+ let b:ale_rust_rustc_options = '--foo'
+
+ AssertEqual
+ \ 'rustc --error-format=json --foo -',
+ \ ale_linters#rust#rustc#RustcCommand(bufnr(''))
+
+Execute(Some default paths should be included when the project is a Cargo project):
+ call ale#test#SetFilename('cargo_paths/test.rs')
+
+ AssertEqual
+ \ 'rustc --error-format=json -Z no-trans'
+ \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(g:dir, 'cargo_paths/target/debug/deps'))
+ \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(g:dir, 'cargo_paths/target/release/deps'))
+ \ . ' -',
+ \ ale_linters#rust#rustc#RustcCommand(bufnr(''))