diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/handler/test_eslint_handler.vader | 58 | ||||
-rw-r--r-- | test/test_highlight_placement.vader | 13 | ||||
-rw-r--r-- | test/test_loclist_corrections.vader | 36 |
3 files changed, 104 insertions, 3 deletions
diff --git a/test/handler/test_eslint_handler.vader b/test/handler/test_eslint_handler.vader index 6d84ff7e..9d5e98fc 100644 --- a/test/handler/test_eslint_handler.vader +++ b/test/handler/test_eslint_handler.vader @@ -5,21 +5,18 @@ Execute(The eslint handler should parse lines correctly): AssertEqual \ [ \ { - \ 'bufnr': 347, \ 'lnum': 47, \ 'col': 14, \ 'text': 'Missing trailing comma. [Warning/comma-dangle]', \ 'type': 'W', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 56, \ 'col': 41, \ 'text': 'Missing semicolon. [Error/semi]', \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 13, \ 'col': 3, \ 'text': 'Parsing error: Unexpected token', @@ -117,3 +114,58 @@ Execute(The eslint handler should print a message for invalid configuration sett \ 'detail': join(g:config_error_lines, "\n"), \ }], \ ale_linters#javascript#eslint#Handle(347, g:config_error_lines[:]) + +Execute(The eslint handler should output end_col values where appropriate): + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 3, + \ 'end_col': 15, + \ 'text': 'Parsing error: Unexpected token ''some string'' [Error]', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 70, + \ 'col': 3, + \ 'end_col': 5, + \ 'text': '''foo'' is not defined. [Error/no-undef]', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 71, + \ 'col': 2, + \ 'end_col': 6, + \ 'text': 'Unexpected `await` inside a loop. [Error/no-await-in-loop]', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 72, + \ 'col': 6, + \ 'end_col': 10, + \ 'text': 'Redundant use of `await` on a return value. [Error/no-return-await]', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 73, + \ 'col': 4, + \ 'end_col': 10, + \ 'text': 'Unexpected console statement [Error/no-console]', + \ 'type': 'E', + \ }, + \ { + \ 'lnum': 74, + \ 'col': 4, + \ 'end_col': 11, + \ 'text': 'Unexpected ''debugger'' statement. [Error/no-debugger]', + \ 'type': 'E', + \ }, + \ ], + \ ale_linters#javascript#eslint#Handle(347, [ + \ 'app.js:4:3: Parsing error: Unexpected token ''some string'' [Error]', + \ 'app.js:70:3: ''foo'' is not defined. [Error/no-undef]', + \ 'app.js:71:2: Unexpected `await` inside a loop. [Error/no-await-in-loop]', + \ 'app.js:72:6: Redundant use of `await` on a return value. [Error/no-return-await]', + \ 'app.js:73:4: Unexpected console statement [Error/no-console]', + \ 'app.js:74:4: Unexpected ''debugger'' statement. [Error/no-debugger]', + \ ]) diff --git a/test/test_highlight_placement.vader b/test/test_highlight_placement.vader index 25c98784..b5878922 100644 --- a/test/test_highlight_placement.vader +++ b/test/test_highlight_placement.vader @@ -137,3 +137,16 @@ Execute(Only ALE highlights should be restored when buffers are restored): " Only our matches should appear again. AssertEqual 1, len(getmatches()), 'The highlights weren''t set again!' + +Execute(Higlight end columns should set an appropriate size): + call ale#highlight#SetHighlights(bufnr('%'), [ + \ {'bufnr': bufnr('%'), 'type': 'E', 'lnum': 3, 'col': 2, 'end_col': 5}, + \ {'bufnr': bufnr('%'), 'type': 'W', 'lnum': 4, 'col': 1, 'end_col': 5}, + \]) + + AssertEqual + \ [ + \ {'group': 'ALEError', 'id': 15, 'priority': 10, 'pos1': [3, 2, 4]}, + \ {'group': 'ALEWarning', 'id': 16, 'priority': 10, 'pos1': [4, 1, 5]}, + \ ], + \ getmatches() diff --git a/test/test_loclist_corrections.vader b/test/test_loclist_corrections.vader index 281f6787..8e01dfbc 100644 --- a/test/test_loclist_corrections.vader +++ b/test/test_loclist_corrections.vader @@ -128,3 +128,39 @@ Execute(FixLocList should convert line and column numbers correctly): \ {'name': 'foobar'}, \ [{'text': 'a', 'lnum': '010', 'col': '010'}], \ ) + +Execute(FixLocList should pass on col_length values): + " The numbers should be 10, not 8 as octals. + AssertEqual + \ [ + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 10, + \ 'end_col': 12, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \ { + \ 'text': 'a', + \ 'lnum': 10, + \ 'col': 11, + \ 'end_col': 12, + \ 'bufnr': bufnr('%'), + \ 'vcol': 0, + \ 'type': 'E', + \ 'nr': -1, + \ 'linter_name': 'foobar', + \ }, + \], + \ ale#engine#FixLocList( + \ bufnr('%'), + \ {'name': 'foobar'}, + \ [ + \ {'text': 'a', 'lnum': '010', 'col': '010', 'end_col': '012'}, + \ {'text': 'a', 'lnum': '010', 'col': '011', 'end_col': 12}, + \ ], + \ ) |