2017-06-18 13:46:34 -04:00
|
|
|
Before:
|
|
|
|
runtime ale_linters/typescript/tslint.vim
|
|
|
|
|
2017-06-25 08:56:51 -04:00
|
|
|
silent! cd /testplugin/test/handler
|
|
|
|
let g:dir = getcwd()
|
|
|
|
|
|
|
|
After:
|
|
|
|
silent execute 'cd ' . fnameescape(g:dir)
|
|
|
|
unlet! g:dir
|
|
|
|
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
2017-06-18 13:46:34 -04:00
|
|
|
Execute(The tslint handler should parse lines correctly):
|
2017-06-25 08:56:51 -04:00
|
|
|
call ale#test#SetFilename('app/test.ts')
|
|
|
|
|
2017-06-18 13:46:34 -04:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
2017-06-25 08:56:51 -04:00
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'col': 15,
|
|
|
|
\ 'end_lnum': 1,
|
|
|
|
\ 'end_col': 15,
|
2017-06-18 13:46:34 -04:00
|
|
|
\ 'text': 'Missing semicolon',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
2017-06-25 08:56:51 -04:00
|
|
|
\ 'lnum': 2,
|
2017-06-25 11:40:44 -04:00
|
|
|
\ 'col': 8,
|
2017-06-25 08:56:51 -04:00
|
|
|
\ 'end_lnum': 3,
|
2017-06-25 11:40:44 -04:00
|
|
|
\ 'end_col': 12,
|
2017-06-25 08:56:51 -04:00
|
|
|
\ 'text': 'Something else',
|
2017-06-18 13:46:34 -04:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
2017-06-25 11:40:44 -04:00
|
|
|
\ {
|
|
|
|
\ 'lnum': 31,
|
|
|
|
\ 'col': 9,
|
|
|
|
\ 'end_lnum': 31,
|
|
|
|
\ 'end_col': 20,
|
|
|
|
\ 'text': 'Calls to console.log are not allowed.',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
2017-06-25 08:56:51 -04:00
|
|
|
\ ],
|
|
|
|
\ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([
|
2017-06-18 13:46:34 -04:00
|
|
|
\ {
|
2017-06-25 08:56:51 -04:00
|
|
|
\ 'endPosition': {
|
|
|
|
\ 'character': 14,
|
|
|
|
\ 'line': 0,
|
2017-06-25 11:40:44 -04:00
|
|
|
\ 'position': 1000
|
2017-06-25 08:56:51 -04:00
|
|
|
\ },
|
|
|
|
\ 'failure': 'Missing semicolon',
|
|
|
|
\ 'fix': {
|
|
|
|
\ 'innerLength': 0,
|
|
|
|
\ 'innerStart': 14,
|
|
|
|
\ 'innerText': ';'
|
|
|
|
\ },
|
|
|
|
\ 'name': 'app/test.ts',
|
|
|
|
\ 'ruleName': 'semicolon',
|
|
|
|
\ 'ruleSeverity': 'ERROR',
|
|
|
|
\ 'startPosition': {
|
|
|
|
\ 'character': 14,
|
|
|
|
\ 'line': 0,
|
2017-06-25 11:40:44 -04:00
|
|
|
\ 'position': 1000
|
2017-06-25 08:56:51 -04:00
|
|
|
\ }
|
2017-06-18 13:46:34 -04:00
|
|
|
\ },
|
2017-06-25 08:56:51 -04:00
|
|
|
\ {
|
|
|
|
\ 'endPosition': {
|
|
|
|
\ 'character': 11,
|
|
|
|
\ 'line': 2,
|
2017-06-25 11:40:44 -04:00
|
|
|
\ 'position': 1000
|
2017-06-25 08:56:51 -04:00
|
|
|
\ },
|
|
|
|
\ 'failure': 'Something else',
|
|
|
|
\ 'fix': {
|
|
|
|
\ 'innerLength': 0,
|
|
|
|
\ 'innerStart': 14,
|
|
|
|
\ 'innerText': ';'
|
|
|
|
\ },
|
|
|
|
\ 'name': 'app/test.ts',
|
|
|
|
\ 'ruleName': 'something',
|
|
|
|
\ 'ruleSeverity': 'WARNING',
|
|
|
|
\ 'startPosition': {
|
|
|
|
\ 'character': 7,
|
|
|
|
\ 'line': 1,
|
2017-06-25 11:40:44 -04:00
|
|
|
\ 'position': 1000
|
2017-06-25 08:56:51 -04:00
|
|
|
\ }
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'endPosition': {
|
|
|
|
\ 'character': 11,
|
|
|
|
\ 'line': 2,
|
|
|
|
\ 'position': 22
|
|
|
|
\ },
|
|
|
|
\ 'failure': 'Something else',
|
|
|
|
\ 'fix': {
|
|
|
|
\ 'innerLength': 0,
|
|
|
|
\ 'innerStart': 14,
|
|
|
|
\ 'innerText': ';'
|
|
|
|
\ },
|
|
|
|
\ 'name': 'app/something-else.ts',
|
|
|
|
\ 'ruleName': 'something',
|
|
|
|
\ 'ruleSeverity': 'WARNING',
|
|
|
|
\ 'startPosition': {
|
|
|
|
\ 'character': 7,
|
|
|
|
\ 'line': 1,
|
|
|
|
\ 'position': 14
|
|
|
|
\ }
|
|
|
|
\ },
|
2017-06-25 11:40:44 -04:00
|
|
|
\ {
|
|
|
|
\ "endPosition": {
|
|
|
|
\ "character": 19,
|
|
|
|
\ "line": 30,
|
|
|
|
\ "position": 14590
|
|
|
|
\ },
|
|
|
|
\ "failure": "Calls to console.log are not allowed.",
|
|
|
|
\ 'name': 'app/test.ts',
|
|
|
|
\ "ruleName": "no-console",
|
|
|
|
\ "startPosition": {
|
|
|
|
\ "character": 8,
|
|
|
|
\ "line": 30,
|
|
|
|
\ "position": 14579
|
|
|
|
\ }
|
|
|
|
\ },
|
2017-06-25 08:56:51 -04:00
|
|
|
\])])
|