1
+ errorModes = require ' ../lib/mode'
1
2
LinterRust = require ' ../lib/linter-rust'
2
3
3
4
linter = new LinterRust ()
4
5
5
- describe " LinterRust ::parse" , ->
6
+ describe " errorModes::OLD_RUSTC ::parse" , ->
6
7
it " should return 0 messages for an empty string" , ->
7
- expect (linter . parse (' ' )).toEqual ([])
8
+ expect (errorModes . OLD_RUSTC . parse (' ' , [] )).toEqual ([])
8
9
9
10
it " should properly parse one line error message" , ->
10
- expect (linter . parse (' my/awesome file.rs:1:2: 3:4 error: my awesome text\n ' ))
11
+ expect (errorModes . OLD_RUSTC . parse (' my/awesome file.rs:1:2: 3:4 error: my awesome text\n ' , [] ))
11
12
.toEqual ([{
12
13
type : ' Error'
13
14
text : ' my awesome text'
@@ -16,7 +17,7 @@ describe "LinterRust::parse", ->
16
17
}])
17
18
18
19
it " should properly parse one line warning message" , ->
19
- expect (linter . parse (' foo:33:44: 22:33 warning: äüö<>\n ' ))
20
+ expect (errorModes . OLD_RUSTC . parse (' foo:33:44: 22:33 warning: äüö<>\n ' , [] ))
20
21
.toEqual ([{
21
22
type : ' Warning' ,
22
23
text : ' äüö<>'
@@ -25,14 +26,14 @@ describe "LinterRust::parse", ->
25
26
}])
26
27
27
28
it " should return messages with a range of at least one character" , ->
28
- expect (linter . parse (' foo:1:1: 1:1 error: text\n ' ))
29
+ expect (errorModes . OLD_RUSTC . parse (' foo:1:1: 1:1 error: text\n ' , [] ))
29
30
.toEqual ([{
30
31
type : ' Error'
31
32
text : ' text'
32
33
filePath : ' foo'
33
34
range : [[0 , 0 ], [0 , 1 ]]
34
35
}])
35
- expect (linter . parse (' foo:1:1: 2:1 error: text\n ' ))
36
+ expect (errorModes . OLD_RUSTC . parse (' foo:1:1: 2:1 error: text\n ' , [] ))
36
37
.toEqual ([{
37
38
type : ' Error'
38
39
text : ' text'
@@ -41,31 +42,31 @@ describe "LinterRust::parse", ->
41
42
}])
42
43
43
44
it " should properly parse multiline messages" , ->
44
- expect (linter .parse (' bar:1:2: 3:4 error: line one\n \
45
- two\n ' ))
45
+ expect (errorModes . OLD_RUSTC .parse (' bar:1:2: 3:4 error: line one\n \
46
+ two\n ' , [] ))
46
47
.toEqual ([
47
48
{ type : ' Error' , text : ' line one\n two' , filePath : ' bar' , range : [[0 , 1 ], [2 , 3 ]] }
48
49
])
49
- expect (linter .parse (' bar:1:2: 3:4 error: line one\n \
50
+ expect (errorModes . OLD_RUSTC .parse (' bar:1:2: 3:4 error: line one\n \
50
51
two\n \
51
- foo:1:1: 1:2 warning: simple line\n ' ))
52
+ foo:1:1: 1:2 warning: simple line\n ' , [] ))
52
53
.toEqual ([
53
54
{ type : ' Error' , text : ' line one\n two' , filePath : ' bar' , range : [[0 , 1 ], [2 , 3 ]] },
54
55
{ type : ' Warning' , text : ' simple line' , filePath : ' foo' , range : [[0 , 0 ], [0 , 1 ]] }
55
56
])
56
- expect (linter .parse (' bar:1:2: 3:4 error: line one\n \
57
+ expect (errorModes . OLD_RUSTC .parse (' bar:1:2: 3:4 error: line one\n \
57
58
two\n \
58
59
three\n \
59
- foo:1 shouldnt match' ))
60
+ foo:1 shouldnt match' , [] ))
60
61
.toEqual ([
61
62
{ type : ' Error' , text : ' line one\n two\n three' , filePath : ' bar' , range : [[0 , 1 ], [2 , 3 ]] }
62
63
])
63
64
64
65
it " should also cope with windows line breaks" , ->
65
- expect (linter . parse (' a:1:2: 3:4 error: a\r\n b\n ' )[0 ].text )
66
+ expect (errorModes . OLD_RUSTC . parse (' a:1:2: 3:4 error: a\r\n b\n ' , [] )[0 ].text )
66
67
.toEqual (' a\r\n b' )
67
68
68
- multi = linter .parse (' a:1:2: 3:4 error: a\n\r b\n\r x:1:2: 3:4 error: asd\r\n ' )
69
+ multi = linter .parse (' a:1:2: 3:4 error: a\n\r b\n\r x:1:2: 3:4 error: asd\r\n ' , [] )
69
70
expect (multi[0 ].text ).toEqual (' a\n\r b' )
70
71
expect (multi[1 ].text ).toEqual (' asd' )
71
72
0 commit comments