Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 0843a00

Browse files
committed
Fixed tests
1 parent 486c3ee commit 0843a00

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

spec/parse-spec.coffee

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
errorModes = require '../lib/mode'
12
LinterRust = require '../lib/linter-rust'
23

34
linter = new LinterRust()
45

5-
describe "LinterRust::parse", ->
6+
describe "errorModes::OLD_RUSTC::parse", ->
67
it "should return 0 messages for an empty string", ->
7-
expect(linter.parse('')).toEqual([])
8+
expect(errorModes.OLD_RUSTC.parse('', [])).toEqual([])
89

910
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', []))
1112
.toEqual([{
1213
type: 'Error'
1314
text: 'my awesome text'
@@ -16,7 +17,7 @@ describe "LinterRust::parse", ->
1617
}])
1718

1819
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', []))
2021
.toEqual([{
2122
type: 'Warning',
2223
text: 'äüö<>'
@@ -25,14 +26,14 @@ describe "LinterRust::parse", ->
2526
}])
2627

2728
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', []))
2930
.toEqual([{
3031
type: 'Error'
3132
text: 'text'
3233
filePath: 'foo'
3334
range: [[0, 0], [0, 1]]
3435
}])
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', []))
3637
.toEqual([{
3738
type: 'Error'
3839
text: 'text'
@@ -41,31 +42,31 @@ describe "LinterRust::parse", ->
4142
}])
4243

4344
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', []))
4647
.toEqual([
4748
{ type: 'Error', text: 'line one\ntwo', filePath: 'bar', range: [[0, 1], [2, 3]] }
4849
])
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\
5051
two\n\
51-
foo:1:1: 1:2 warning: simple line\n'))
52+
foo:1:1: 1:2 warning: simple line\n', []))
5253
.toEqual([
5354
{ type: 'Error', text: 'line one\ntwo', filePath: 'bar', range: [[0, 1], [2, 3]] },
5455
{ type: 'Warning', text: 'simple line', filePath: 'foo', range: [[0, 0], [0, 1]] }
5556
])
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\
5758
two\n\
5859
three\n\
59-
foo:1 shouldnt match'))
60+
foo:1 shouldnt match', []))
6061
.toEqual([
6162
{ type: 'Error', text: 'line one\ntwo\nthree', filePath: 'bar', range: [[0, 1], [2, 3]] }
6263
])
6364

6465
it "should also cope with windows line breaks", ->
65-
expect(linter.parse('a:1:2: 3:4 error: a\r\nb\n')[0].text)
66+
expect(errorModes.OLD_RUSTC.parse('a:1:2: 3:4 error: a\r\nb\n', [])[0].text)
6667
.toEqual('a\r\nb')
6768

68-
multi = linter.parse('a:1:2: 3:4 error: a\n\rb\n\rx:1:2: 3:4 error: asd\r\n')
69+
multi = linter.parse('a:1:2: 3:4 error: a\n\rb\n\rx:1:2: 3:4 error: asd\r\n', [])
6970
expect(multi[0].text).toEqual('a\n\rb')
7071
expect(multi[1].text).toEqual('asd')
7172

0 commit comments

Comments
 (0)