summaryrefslogtreecommitdiff
path: root/test/test_loclist_corrections.vader
diff options
context:
space:
mode:
authorBjorn Neergaard <bjorn@neersighted.com>2018-11-29 14:57:35 -0700
committerBjorn Neergaard <bjorn@neersighted.com>2018-11-29 14:57:35 -0700
commitd2b0ae8108b2ee395d4eb43c49d68b322a023a30 (patch)
treebb8145e69bf1bcb8968b29cb1a68c47ceb83674d /test/test_loclist_corrections.vader
parentef641dda80f45cb979bc93c2513c6e10cbd8e42a (diff)
parent0a384a49d371838903d8401c5358ec60f3f4266d (diff)
downloadale-d2b0ae8108b2ee395d4eb43c49d68b322a023a30.zip
Merge branch 'master' into sridhars
Diffstat (limited to 'test/test_loclist_corrections.vader')
-rw-r--r--test/test_loclist_corrections.vader45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/test_loclist_corrections.vader b/test/test_loclist_corrections.vader
index 48aa1f78..343620a5 100644
--- a/test/test_loclist_corrections.vader
+++ b/test/test_loclist_corrections.vader
@@ -41,6 +41,7 @@ Execute(FixLocList should set all the default values correctly):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': 2}, {'text': 'b', 'lnum': 2}],
\ )
@@ -61,6 +62,7 @@ Execute(FixLocList should use the values we supply):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{
\ 'text': 'a',
\ 'lnum': 3,
@@ -89,6 +91,7 @@ Execute(FixLocList should set items with lines beyond the end to the last line):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': 11}],
\ )
@@ -109,6 +112,7 @@ Execute(FixLocList should move line 0 to line 1):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': 0}],
\ )
@@ -130,6 +134,7 @@ Execute(FixLocList should convert line and column numbers correctly):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': '010', 'col': '010'}],
\ )
@@ -163,6 +168,7 @@ Execute(FixLocList should pass on end_col values):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [
\ {'text': 'a', 'lnum': '010', 'col': '010', 'end_col': '012'},
\ {'text': 'a', 'lnum': '010', 'col': '011', 'end_col': 12},
@@ -200,6 +206,7 @@ Execute(FixLocList should pass on end_lnum values):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [
\ {'text': 'a', 'lnum': '010', 'col': '010', 'end_col': '012', 'end_lnum': '013'},
\ {'text': 'a', 'lnum': '010', 'col': '011', 'end_col': 12, 'end_lnum': 13},
@@ -224,6 +231,7 @@ Execute(FixLocList should allow subtypes to be set):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': 11, 'sub_type': 'style'}],
\ )
@@ -285,6 +293,7 @@ Execute(FixLocList should accept filenames):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [
\ {'text': 'a', 'lnum': 2, 'filename': expand('%:p')},
\ {'text': 'a', 'lnum': 3, 'filename': expand('%:p')},
@@ -322,6 +331,7 @@ Execute(FixLocList should interpret temporary filenames as being the current buf
\ ale#engine#FixLocList(
\ bufnr(''),
\ 'foobar',
+ \ 0,
\ [
\ {'text': 'a', 'lnum': 2, 'filename': b:temp_name},
\ {'text': 'a', 'lnum': 3, 'filename': substitute(b:temp_name, '\\', '/', 'g')},
@@ -346,9 +356,43 @@ Execute(The error code should be passed on):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': 11, 'code': 'some-code'}],
\ )
+Execute(FixLocList should mark problems as coming from other sources if requested):
+ AssertEqual
+ \ [
+ \ {
+ \ 'text': 'a',
+ \ 'lnum': 2,
+ \ 'col': 0,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'linter_name': 'foobar',
+ \ 'from_other_source': 1,
+ \ },
+ \ {
+ \ 'text': 'b',
+ \ 'lnum': 2,
+ \ 'col': 0,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'linter_name': 'foobar',
+ \ 'from_other_source': 1,
+ \ },
+ \],
+ \ ale#engine#FixLocList(
+ \ bufnr('%'),
+ \ 'foobar',
+ \ 1,
+ \ [{'text': 'a', 'lnum': 2}, {'text': 'b', 'lnum': 2}],
+ \ )
+
Given(A file with Japanese multi-byte text):
はじめまして!
-私はワープです。
@@ -367,6 +411,7 @@ Execute(character positions should be converted to byte positions):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [
\ {'text': 'a', 'lnum': 1, 'col': 0, 'vcol': 1},
\ {'text': 'a', 'lnum': 1, 'col': 1, 'vcol': 1},