summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@gmail.com>2020-05-10 08:21:02 -0400
committerBen Boeckel <mathstuf@gmail.com>2020-08-13 10:22:33 -0400
commit506a8532d07fd7e15e9a6cc37d490f7b7088aef5 (patch)
tree0c4cc7182e7c8595a96eff07e11d3a0e8de9bf63 /test/command_callback
parent0b7776633764ab4a3c25b73e8ef8a604bebdd638 (diff)
downloadale-506a8532d07fd7e15e9a6cc37d490f7b7088aef5.zip
rust/cargo: add support for a custom target directory
This can avoid having to wait for ALE or ALE being blocked on other cargo actions within the same crate.
Diffstat (limited to 'test/command_callback')
-rw-r--r--test/command_callback/test_cargo_command_callbacks.vader24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/command_callback/test_cargo_command_callbacks.vader b/test/command_callback/test_cargo_command_callbacks.vader
index e56551ae..2d83351e 100644
--- a/test/command_callback/test_cargo_command_callbacks.vader
+++ b/test/command_callback/test_cargo_command_callbacks.vader
@@ -169,10 +169,11 @@ Execute(Build supports all cargo flags):
let g:ale_rust_cargo_check_tests = 1
let g:ale_rust_cargo_check_examples = 1
let b:ale_rust_cargo_default_feature_behavior = 'all'
+ let b:ale_rust_cargo_target_dir = 'target/ale'
AssertLinter 'cargo', [
\ ale#Escape('cargo') . ' --version',
- \ 'cargo build --all-targets --examples --tests --frozen --message-format=json -q --all-features',
+ \ 'cargo build --all-targets --examples --tests --target-dir ' . ale#Escape('target/ale') . ' --frozen --message-format=json -q --all-features',
\]
Execute(Clippy supports all cargo flags):
@@ -182,10 +183,11 @@ Execute(Clippy supports all cargo flags):
let g:ale_rust_cargo_check_examples = 1
let b:ale_rust_cargo_default_feature_behavior = 'all'
let b:ale_rust_cargo_clippy_options = '-D warnings'
+ let b:ale_rust_cargo_target_dir = 'target/ale'
AssertLinter 'cargo', [
\ ale#Escape('cargo') . ' --version',
- \ 'cargo clippy --all-targets --examples --tests --frozen --message-format=json -q --all-features -- -D warnings',
+ \ 'cargo clippy --all-targets --examples --tests --target-dir ' . ale#Escape('target/ale') . ' --frozen --message-format=json -q --all-features -- -D warnings',
\]
Execute(cargo-check does not refer ale_rust_cargo_clippy_options):
@@ -197,3 +199,21 @@ Execute(cargo-check does not refer ale_rust_cargo_clippy_options):
\ ale#Escape('cargo') . ' --version',
\ 'cargo check --frozen --message-format=json -q',
\]
+
+Execute(`cargo --target-dir` should be used when the version is new enough and it is set):
+ let b:ale_rust_cargo_target_dir = 'target/ale'
+
+ GivenCommandOutput ['cargo 0.17.0 (3423351a5 2017-10-06)']
+ AssertLinter 'cargo', [
+ \ ale#Escape('cargo') . ' --version',
+ \ 'cargo check --target-dir ' . ale#Escape('target/ale') . g:suffix,
+ \]
+
+Execute(`cargo --target-dir` should not be used when the version is not new enough and it is set):
+ let b:ale_rust_cargo_target_dir = 'target/ale'
+
+ GivenCommandOutput ['cargo 0.16.0 (3423351a5 2017-10-06)']
+ AssertLinter 'cargo', [
+ \ ale#Escape('cargo') . ' --version',
+ \ 'cargo build' . g:suffix,
+ \]