2017-05-17 15:19:34 -04:00
|
|
|
Before:
|
|
|
|
runtime ale_linters/php/php.vim
|
|
|
|
|
2017-11-15 12:21:17 -05:00
|
|
|
After:
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
2017-03-01 18:26:03 -05:00
|
|
|
Given (Some invalid lines of PHP):
|
|
|
|
[foo;]
|
|
|
|
class Foo { / }
|
|
|
|
$foo)
|
|
|
|
['foo' 'bar']
|
2017-04-12 17:59:12 -04:00
|
|
|
function count() {}
|
2017-03-01 18:26:03 -05:00
|
|
|
|
2017-05-17 15:19:34 -04:00
|
|
|
Execute(The php handler should calculate column numbers):
|
2017-02-15 17:59:18 -05:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
2017-03-01 18:26:03 -05:00
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'col': 5,
|
2017-05-17 15:28:29 -04:00
|
|
|
\ 'end_col': 5,
|
2017-02-15 17:59:18 -05:00
|
|
|
\ 'text': "syntax error, unexpected ';', expecting ']'",
|
|
|
|
\ },
|
|
|
|
\ {
|
2017-03-01 18:26:03 -05:00
|
|
|
\ 'lnum': 2,
|
|
|
|
\ 'col': 13,
|
2017-05-17 15:28:29 -04:00
|
|
|
\ 'end_col': 13,
|
2017-02-15 17:59:18 -05:00
|
|
|
\ 'text': "syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST)",
|
|
|
|
\ },
|
|
|
|
\ {
|
2017-03-01 18:26:03 -05:00
|
|
|
\ 'lnum': 3,
|
|
|
|
\ 'col': 5,
|
2017-05-17 15:28:29 -04:00
|
|
|
\ 'end_col': 5,
|
2017-02-15 17:59:18 -05:00
|
|
|
\ 'text': "syntax error, unexpected ')'",
|
|
|
|
\ },
|
2017-02-17 18:51:33 -05:00
|
|
|
\ {
|
2017-03-01 18:26:03 -05:00
|
|
|
\ 'lnum': 4,
|
|
|
|
\ 'col': 8,
|
2017-05-17 15:28:29 -04:00
|
|
|
\ 'end_col': 12,
|
2017-03-01 18:26:03 -05:00
|
|
|
\ 'text': "syntax error, unexpected ''bar'' (T_CONSTANT_ENCAPSED_STRING), expecting ']'",
|
2017-02-17 18:51:33 -05:00
|
|
|
\ },
|
2017-05-17 15:19:34 -04:00
|
|
|
\ ],
|
|
|
|
\ ale_linters#php#php#Handle(347, [
|
|
|
|
\ "This line should be ignored completely",
|
|
|
|
\ "Parse error: syntax error, unexpected ';', expecting ']' in - on line 1",
|
|
|
|
\ "Parse error: syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST) in - on line 2",
|
|
|
|
\ "Parse error: syntax error, unexpected ')' in - on line 3",
|
|
|
|
\ "Parse error: syntax error, unexpected ''bar'' (T_CONSTANT_ENCAPSED_STRING), expecting ']' in - on line 4",
|
|
|
|
\ ])
|
|
|
|
|
|
|
|
Execute (The php handler should ignore lines starting with 'PHP Parse error'):
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale_linters#php#php#Handle(347, [
|
|
|
|
\ "PHP Parse error: syntax error, This line should be ignored completely in - on line 1",
|
|
|
|
\ ])
|
|
|
|
|
|
|
|
Execute (The php handler should parse lines without column indication):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
2017-02-17 18:51:33 -05:00
|
|
|
\ {
|
2017-04-12 17:59:12 -04:00
|
|
|
\ 'lnum': 5,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'text': "Cannot redeclare count()",
|
|
|
|
\ },
|
|
|
|
\ {
|
2017-02-17 18:51:33 -05:00
|
|
|
\ 'lnum': 21,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'text': "syntax error, unexpected end of file",
|
|
|
|
\ },
|
2017-03-01 18:26:03 -05:00
|
|
|
\ {
|
|
|
|
\ 'lnum': 47,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'text': "Invalid numeric literal",
|
|
|
|
\ },
|
2017-02-15 17:59:18 -05:00
|
|
|
\ ],
|
|
|
|
\ ale_linters#php#php#Handle(347, [
|
2017-05-17 15:19:34 -04:00
|
|
|
\ "This line should be ignored completely",
|
2017-05-08 16:17:54 -04:00
|
|
|
\ "Fatal error: Cannot redeclare count() in - on line 5",
|
2017-05-17 15:19:34 -04:00
|
|
|
\ "Parse error: syntax error, unexpected end of file in - on line 21",
|
|
|
|
\ "Parse error: Invalid numeric literal in - on line 47",
|
2017-02-15 17:59:18 -05:00
|
|
|
\ ])
|