summaryrefslogtreecommitdiff
path: root/test/test_loclist_corrections.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_loclist_corrections.vader')
-rw-r--r--test/test_loclist_corrections.vader32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/test_loclist_corrections.vader b/test/test_loclist_corrections.vader
index 46c7e272..48aa1f78 100644
--- a/test/test_loclist_corrections.vader
+++ b/test/test_loclist_corrections.vader
@@ -52,7 +52,7 @@ Execute(FixLocList should use the values we supply):
\ 'lnum': 3,
\ 'col': 4,
\ 'bufnr': 10000,
- \ 'vcol': 1,
+ \ 'vcol': 0,
\ 'type': 'W',
\ 'nr': 42,
\ 'linter_name': 'foobar',
@@ -348,3 +348,33 @@ Execute(The error code should be passed on):
\ 'foobar',
\ [{'text': 'a', 'lnum': 11, 'code': 'some-code'}],
\ )
+
+Given(A file with Japanese multi-byte text):
+ はじめまして!
+ -私はワープです。
+Execute(character positions should be converted to byte positions):
+ AssertEqual
+ \ [
+ \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 0, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
+ \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 1, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
+ \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 4, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
+ \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 7, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
+ \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 7, 'end_col': 13, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
+ \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 7, 'end_col': 13, 'end_lnum': 1, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
+ \ {'lnum': 1, 'bufnr': bufnr(''), 'col': 7, 'end_col': 17, 'end_lnum': 2, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
+ \ {'lnum': 2, 'bufnr': bufnr(''), 'col': 17, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
+ \],
+ \ ale#engine#FixLocList(
+ \ bufnr('%'),
+ \ 'foobar',
+ \ [
+ \ {'text': 'a', 'lnum': 1, 'col': 0, 'vcol': 1},
+ \ {'text': 'a', 'lnum': 1, 'col': 1, 'vcol': 1},
+ \ {'text': 'a', 'lnum': 1, 'col': 2, 'vcol': 1},
+ \ {'text': 'a', 'lnum': 1, 'col': 3, 'vcol': 1},
+ \ {'text': 'a', 'lnum': 1, 'col': 3, 'end_col': 5, 'vcol': 1},
+ \ {'text': 'a', 'lnum': 1, 'col': 3, 'end_col': 5, 'end_lnum': 1, 'vcol': 1},
+ \ {'text': 'a', 'lnum': 1, 'col': 3, 'end_col': 7, 'end_lnum': 2, 'vcol': 1},
+ \ {'text': 'a', 'lnum': 2, 'col': 7, 'vcol': 1},
+ \ ],
+ \ )