summaryrefslogtreecommitdiff
path: root/test/test_loclist_corrections.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-04-08 17:17:30 +0100
committerw0rp <devw0rp@gmail.com>2018-04-08 17:17:46 +0100
commit91d7e81ebc08581fc0339c939c0adecaa590f2f7 (patch)
tree3773dfccbeb678de38c75923e30654f7e67711e2 /test/test_loclist_corrections.vader
parent121e806423830fa9e6bc1c7833f0624bd06903ff (diff)
downloadale-91d7e81ebc08581fc0339c939c0adecaa590f2f7.zip
Fix #605 - Support `vcol: 1` for multi-byte character positions
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},
+ \ ],
+ \ )