summaryrefslogtreecommitdiff
path: root/test/handler/test_rust_handler.vader
blob: 38228f381493ac302947d972468f721fcbcc7a84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Execute(The Rust handler should handle rustc output):
  AssertEqual
  \ [
  \   {
  \     'lnum': 15,
  \     'end_lnum': 15,
  \     'type': 'E',
  \     'col': 418,
  \     'end_col': 421,
  \     'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`',
  \   },
  \   {
  \      'lnum': 13,
  \      'end_lnum': 13,
  \      'type': 'E',
  \      'col': 407,
  \      'end_col': 410,
  \      'text': 'no method named `wat` found for type `std::string::String` in the current scope',
  \   },
  \ ],
  \ ale#handlers#rust#HandleRustErrorsForFile(347, '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}',
  \   '{"message":"main function not found","code":null,"level":"error","spans":[],"children":[],"rendered":null}',
  \   '{"message":"no method named `wat` found for type `std::string::String` in the current scope","code":null,"level":"error","spans":[{"file_name":"<anon>","byte_start":407,"byte_end":410,"line_start":13,"line_end":13,"column_start":7,"column_end":10,"is_primary":true,"text":[{"text":"    s.wat()","highlight_start":7,"highlight_end":10}],"label":null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}',
  \   '{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":null}',
  \ ])

Execute(The Rust handler should handle cargo output):
  AssertEqual
  \ [
  \   {
  \     'lnum': 15,
  \     'end_lnum': 15,
  \     'type': 'E',
  \     'col': 11505,
  \     'end_col': 11508,
  \     'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`',
  \   },
  \   {
  \     'lnum': 13,
  \     'end_lnum': 13,
  \     'type': 'E',
  \     'col': 11494,
  \     'end_col': 11497,
  \     'text': 'no method named `wat` found for type `std::string::String` in the current scope',
  \   },
  \ ],
  \ ale#handlers#rust#HandleRustErrorsForFile(347, '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"}}',
  \   '{"message":{"children":[],"code":null,"level":"error","message":"no method named `wat` found for type `std::string::String` in the current scope","rendered":null,"spans":[{"byte_end":11497,"byte_start":11494,"column_end":10,"column_start":7,"expansion":null,"file_name":"src/playpen.rs","is_primary":true,"label":null,"line_end":13,"line_start":13,"suggested_replacement":null,"text":[{"highlight_end":10,"highlight_start":7,"text":"    s.wat()"}]}]},"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"}}',
  \   '{"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 find correct files):
  AssertEqual
  \ [],
  \ ale#handlers#rust#HandleRustErrorsForFile(347, '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"}}',
  \   '{"message":{"children":[],"code":null,"level":"error","message":"aborting due to previous error","rendered":null,"spans":[]},"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"}}',
  \ ])