summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordaa84 <andrey.dubravin@gmail.com>2017-07-07 19:03:17 +0300
committerw0rp <w0rp@users.noreply.github.com>2017-07-07 17:03:17 +0100
commit46225f3bb13a242bf3b218d395f3911f013d5f14 (patch)
tree537f368d95307f1ff60393f1579f08dc5d8b9ac8 /test
parentd9a7364dae5af3f193fa9e4cee221730a8ffd46e (diff)
downloadale-46225f3bb13a242bf3b218d395f3911f013d5f14.zip
Fix windows path check on rust linter (#736)
* Fix rust linter on windows * Add windows path test * Use ale#path#IsBufferPath to compare paths * Fix errors
Diffstat (limited to 'test')
-rw-r--r--test/handler/test_rust_handler.vader34
1 files changed, 30 insertions, 4 deletions
diff --git a/test/handler/test_rust_handler.vader b/test/handler/test_rust_handler.vader
index 11dcf17f..510ae699 100644
--- a/test/handler/test_rust_handler.vader
+++ b/test/handler/test_rust_handler.vader
@@ -1,4 +1,6 @@
Execute(The Rust handler should handle rustc output):
+ call ale#test#SetFilename('src/playpen.rs')
+
AssertEqual
\ [
\ {
@@ -18,7 +20,7 @@ Execute(The Rust handler should handle rustc output):
\ 'text': 'no method named `wat` found for type `std::string::String` in the current scope',
\ },
\ ],
- \ ale#handlers#rust#HandleRustErrorsForFile(347, 'src/playpen.rs', [
+ \ ale#handlers#rust#HandleRustErrorsForFile(bufnr(''), 'src/playpen.rs', [
\ '',
\ 'ignore this',
\ '{"message":"expected one of `.`, `;`, `?`, `}`, or an operator, found `for`","code":null,"level":"error","spans":[{"file_name":"<anon>","byte_start":418,"byte_end":421,"line_start":15,"line_end":15,"column_start":5,"column_end":8,"is_primary":true,"text":[{"text":" for chr in source.trim().chars() {","highlight_start":5,"highlight_end":8}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}',
@@ -28,6 +30,8 @@ Execute(The Rust handler should handle rustc output):
\ ])
Execute(The Rust handler should handle cargo output):
+ call ale#test#SetFilename('src/playpen.rs')
+
AssertEqual
\ [
\ {
@@ -47,7 +51,7 @@ Execute(The Rust handler should handle cargo output):
\ 'text': 'no method named `wat` found for type `std::string::String` in the current scope',
\ },
\ ],
- \ ale#handlers#rust#HandleRustErrorsForFile(347, 'src/playpen.rs', [
+ \ ale#handlers#rust#HandleRustErrorsForFile(bufnr(''), 'src/playpen.rs', [
\ '',
\ 'ignore this',
\ '{"message":{"children":[],"code":null,"level":"error","message":"expected one of `.`, `;`, `?`, `}`, or an operator, found `for`","rendered":null,"spans":[{"byte_end":11508,"byte_start":11505,"column_end":8,"column_start":5,"expansion":null,"file_name":"src/playpen.rs","is_primary":true,"label":null,"line_end":15,"line_start":15,"suggested_replacement":null,"text":[{"highlight_end":8,"highlight_start":5,"text":" for chr in source.trim().chars() {"}]}]},"package_id":"update 0.0.1 (path+file:///home/w0rp/Downloads/rust-by-example)","reason":"compiler-message","target":{"kind":["bin"],"name":"update","src_path":"/home/w0rp/Downloads/rust-by-example/src/main.rs"}}',
@@ -55,7 +59,27 @@ Execute(The Rust handler should handle cargo output):
\ '{"message":{"children":[],"code":null,"level":"error","message":"aborting due to previous error","rendered":null,"spans":[]},"package_id":"update 0.0.1 (path+file:///home/w0rp/Downloads/rust-by-example)","reason":"compiler-message","target":{"kind":["bin"],"name":"update","src_path":"/home/w0rp/Downloads/rust-by-example/src/main.rs"}}',
\ ])
+" Execute(The Rust handler should handle cargo output on Windows):
+" call ale#test#SetFilename('src\nvim.rs')
+"
+" AssertEqual
+" \ [
+" \ {
+" \ 'lnum': 467,
+" \ 'end_lnum': 467,
+" \ 'type': 'E',
+" \ 'col': 43198,
+" \ 'end_col': 43199,
+" \ 'text': 'expected one of `!` or `::`, found `#`: unexpected token',
+" \ },
+" \ ],
+" \ ale#handlers#rust#HandleRustErrorsForFile(bufnr(''), 'src\nvim.rs', [
+" \ '{"message":{"children":[],"code":null,"level":"error","message":"expected one of `!` or `::`, found `#`","rendered":null,"spans":[{"byte_end":43199,"byte_start":43198,"column_end":2,"column_start":1,"expansion":null,"file_name":"src\\nvim.rs","is_primary":true,"label":"unexpected token","line_end":467,"line_start":467,"suggested_replacement":null,"text":[{"highlight_end":2,"highlight_start":1,"text":"#[cfg(test)]\r"}]}]},"package_id":"nvim-gtk 0.1.2 (path+file:///E:/daa/local/neovim-gtk)","reason":"compiler-message","target":{"crate_types":["bin"],"kind":["bin"],"name":"nvim-gtk","src_path":"E:\\daa\\local\\neovim-gtk\\src\\main.rs"}}',
+" \ ])
+
Execute(The Rust handler should show detailed errors):
+ call ale#test#SetFilename('src/playpen.rs')
+
AssertEqual
\ [
\ {
@@ -67,7 +91,7 @@ Execute(The Rust handler should show detailed errors):
\ 'text': 'mismatched types: expected bool, found integral variable',
\ },
\ ],
- \ ale#handlers#rust#HandleRustErrorsForFile(347, 'src/playpen.rs', [
+ \ ale#handlers#rust#HandleRustErrorsForFile(bufnr(''), 'src/playpen.rs', [
\ '',
\ 'ignore this',
\ '{"message":{"children":[],"code":null,"level":"error","message":"mismatched types","rendered":null,"spans":[{"byte_end":54,"byte_start":52,"column_end":23,"column_start":21,"expansion":null,"file_name":"src/playpen.rs","is_primary":true,"label":"expected bool, found integral variable","line_end":4,"line_start":4,"suggested_replacement":null,"text":[{"highlight_end":23,"highlight_start":21,"text":" let foo: bool = 42;"}]}]},"package_id":"ale-rust-details 0.1.1 (path+file:///home/jon/tmp/ale-rust-details)","reason":"compiler-message","target":{"crate_types":["bin"],"kind":["bin"],"name":"ale-rust-details","src_path":"/home/jon/tmp/ale-rust-details/src/main.rs"}}',
@@ -75,9 +99,11 @@ Execute(The Rust handler should show detailed errors):
\ ])
Execute(The Rust handler should find correct files):
+ call ale#test#SetFilename('src/noerrors/mod.rs')
+
AssertEqual
\ [],
- \ ale#handlers#rust#HandleRustErrorsForFile(347, 'src/noerrors/mod.rs', [
+ \ ale#handlers#rust#HandleRustErrorsForFile(bufnr(''), 'src/noerrors/mod.rs', [
\ '',
\ 'ignore this',
\ '{"message":{"children":[],"code":null,"level":"error","message":"unresolved import `Undefined`","rendered":null,"spans":[{"byte_end":103,"byte_start":94,"column_end":14,"column_start":5,"expansion":null,"file_name":"src/haserrors/mod.rs","is_primary":true,"label":"no `Undefined` in the root","line_end":1,"line_start":1,"suggested_replacement":null,"text":[{"highlight_end":14,"highlight_start":5,"text":"use Undefined;"}]}]},"package_id":"sample 0.1.0 (path+file:///private/tmp/sample)","reason":"compiler-message","target":{"crate_types":["lib"],"kind":["lib"],"name":"sample","src_path":"/private/tmp/sample/src/lib.rs"}}',