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