120 lines
2.6 KiB
Plaintext
120 lines
2.6 KiB
Plaintext
Before:
|
|
runtime ale_linters/typescript/tslint.vim
|
|
|
|
call ale#test#SetDirectory('/testplugin/test/handler')
|
|
|
|
After:
|
|
call ale#test#RestoreDirectory()
|
|
call ale#linter#Reset()
|
|
|
|
Execute(The tslint handler should parse lines correctly):
|
|
call ale#test#SetFilename('app/test.ts')
|
|
|
|
AssertEqual
|
|
\ [
|
|
\ {
|
|
\ 'lnum': 1,
|
|
\ 'col': 15,
|
|
\ 'end_lnum': 1,
|
|
\ 'end_col': 15,
|
|
\ 'text': 'Missing semicolon',
|
|
\ 'type': 'E',
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 2,
|
|
\ 'col': 8,
|
|
\ 'end_lnum': 3,
|
|
\ 'end_col': 12,
|
|
\ 'text': 'Something else',
|
|
\ 'type': 'W',
|
|
\ },
|
|
\ {
|
|
\ 'lnum': 31,
|
|
\ 'col': 9,
|
|
\ 'end_lnum': 31,
|
|
\ 'end_col': 20,
|
|
\ 'text': 'Calls to console.log are not allowed.',
|
|
\ 'type': 'E',
|
|
\ },
|
|
\ ],
|
|
\ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([
|
|
\ {
|
|
\ 'endPosition': {
|
|
\ 'character': 14,
|
|
\ 'line': 0,
|
|
\ 'position': 1000
|
|
\ },
|
|
\ 'failure': 'Missing semicolon',
|
|
\ 'fix': {
|
|
\ 'innerLength': 0,
|
|
\ 'innerStart': 14,
|
|
\ 'innerText': ';'
|
|
\ },
|
|
\ 'name': 'app/test.ts',
|
|
\ 'ruleName': 'semicolon',
|
|
\ 'ruleSeverity': 'ERROR',
|
|
\ 'startPosition': {
|
|
\ 'character': 14,
|
|
\ 'line': 0,
|
|
\ 'position': 1000
|
|
\ }
|
|
\ },
|
|
\ {
|
|
\ 'endPosition': {
|
|
\ 'character': 11,
|
|
\ 'line': 2,
|
|
\ 'position': 1000
|
|
\ },
|
|
\ 'failure': 'Something else',
|
|
\ 'fix': {
|
|
\ 'innerLength': 0,
|
|
\ 'innerStart': 14,
|
|
\ 'innerText': ';'
|
|
\ },
|
|
\ 'name': 'app/test.ts',
|
|
\ 'ruleName': 'something',
|
|
\ 'ruleSeverity': 'WARNING',
|
|
\ 'startPosition': {
|
|
\ 'character': 7,
|
|
\ 'line': 1,
|
|
\ 'position': 1000
|
|
\ }
|
|
\ },
|
|
\ {
|
|
\ '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
|
|
\ }
|
|
\ },
|
|
\ {
|
|
\ "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
|
|
\ }
|
|
\ },
|
|
\])])
|