summaryrefslogtreecommitdiff
path: root/test/linter
diff options
context:
space:
mode:
authorFelix Maurer <felix@felix-maurer.de>2022-03-23 02:56:29 +0100
committerGitHub <noreply@github.com>2022-03-23 10:56:29 +0900
commit80dcd648d389965603246c2c5a4554e3e4aa184c (patch)
treec6a226966fd879df41360632103f366fef2d444e /test/linter
parent5c7019f394588bdc29d7573f5063198c2803dfe4 (diff)
downloadale-80dcd648d389965603246c2c5a4554e3e4aa184c.zip
rust-analyzer for non-Cargo projects (#4118)
* rust-analyzer in non-cargo projects rust-analyzer can also be used in non-cargo projects. This requires a rust-project.json file in the project root [1]. Make the rust-analyzer linter search for a rust-project.json file if no Cargo.toml file could be found. [1]: https://rust-analyzer.github.io/manual.html#non-cargo-based-projects * Document rust-analyzer without cargo * Test rust-analyzer with non-cargo projects Change the other rust tests to match the new directory structure of the test files.
Diffstat (limited to 'test/linter')
-rw-r--r--test/linter/test_rust_analyzer.vader13
-rw-r--r--test/linter/test_rust_rls.vader4
-rw-r--r--test/linter/test_rustc.vader6
3 files changed, 15 insertions, 8 deletions
diff --git a/test/linter/test_rust_analyzer.vader b/test/linter/test_rust_analyzer.vader
index 82a3adfb..2ee996c7 100644
--- a/test/linter/test_rust_analyzer.vader
+++ b/test/linter/test_rust_analyzer.vader
@@ -7,12 +7,19 @@ After:
Execute(The default executable path should be correct):
AssertLinter 'rust-analyzer', ale#Escape('rust-analyzer')
-Execute(The project root should be detected correctly):
+Execute(The project root should be detected correctly in cargo projects):
AssertLSPProject ''
- call ale#test#SetFilename('../test-files/rust/test.rs')
+ call ale#test#SetFilename('../test-files/rust/cargo/testfile.rs')
- AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/rust')
+ AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/rust/cargo')
+
+Execute(The project root should be detected correctly in non-cargo projects):
+ AssertLSPProject ''
+
+ call ale#test#SetFilename('../test-files/rust/rust-project/testfile.rs')
+
+ AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/rust/rust-project')
Execute(Should accept configuration settings):
AssertLSPConfig {}
diff --git a/test/linter/test_rust_rls.vader b/test/linter/test_rust_rls.vader
index 9ca25619..0b684c52 100644
--- a/test/linter/test_rust_rls.vader
+++ b/test/linter/test_rust_rls.vader
@@ -20,9 +20,9 @@ Execute(The toolchain should be ommitted if not given):
Execute(The project root should be detected correctly):
AssertLSPProject ''
- call ale#test#SetFilename('../test-files/rust/test.rs')
+ call ale#test#SetFilename('../test-files/rust/cargo/testfile.rs')
- AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/rust')
+ AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/rust/cargo')
Execute(Should accept configuration settings):
AssertLSPConfig {}
diff --git a/test/linter/test_rustc.vader b/test/linter/test_rustc.vader
index 41e3c735..37b7a8c2 100644
--- a/test/linter/test_rustc.vader
+++ b/test/linter/test_rustc.vader
@@ -13,9 +13,9 @@ Execute(The options should be configurable):
AssertLinter 'rustc', 'rustc --error-format=json --foo -'
Execute(Some default paths should be included when the project is a Cargo project):
- call ale#test#SetFilename('../test-files/cargo/test.rs')
+ call ale#test#SetFilename('../test-files/rust/cargo/testfile.rs')
AssertLinter 'rustc', 'rustc --error-format=json --emit=mir -o /dev/null'
- \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(g:dir, '../test-files/cargo/target/debug/deps'))
- \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(g:dir, '../test-files/cargo/target/release/deps'))
+ \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(g:dir, '../test-files/rust/cargo/target/debug/deps'))
+ \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(g:dir, '../test-files/rust/cargo/target/release/deps'))
\ . ' -'