From b2241e991bee98e5a085384061bd5e2de4026afc Mon Sep 17 00:00:00 2001 From: Adriaan Zonnenberg Date: Wed, 15 Feb 2017 23:59:18 +0100 Subject: Support columns on php handler Also added some tests for different error messages --- test/test_php_handler.vader | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 test/test_php_handler.vader (limited to 'test/test_php_handler.vader') diff --git a/test/test_php_handler.vader b/test/test_php_handler.vader new file mode 100644 index 00000000..11bb2d53 --- /dev/null +++ b/test/test_php_handler.vader @@ -0,0 +1,59 @@ +Execute(The php handler should parse lines correctly): + runtime ale_linters/php/php.vim + + AssertEqual + \ [ + \ { + \ 'bufnr': 347, + \ 'lnum': 47, + \ 'vcol': 0, + \ 'col': 0, + \ 'text': "syntax error, unexpected ';', expecting ']'", + \ 'type': 'E', + \ 'nr': -1, + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 56, + \ 'vcol': 0, + \ 'col': 0, + \ 'text': "syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST)", + \ 'type': 'E', + \ 'nr': -1, + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 13, + \ 'vcol': 0, + \ 'col': 0, + \ 'text': "syntax error, unexpected ')'", + \ 'type': 'E', + \ 'nr': -1, + \ }, + \ ], + \ ale_linters#php#php#Handle(347, [ + \ 'This line should be ignored completely', + \ "PHP Parse error: syntax error, unexpected ';', expecting ']' in - on line 47", + \ "PHP Parse error: syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST) in - on line 56", + \ 'This line should be ignored completely', + \ "PHP Parse error: syntax error, unexpected ')' in - on line 13", + \ ]) + +After: + call ale#linter#Reset() + + +Given php(A function call with missing argument delimiters): + Date: Sat, 18 Feb 2017 00:04:59 +0100 Subject: PHP: Fix test for column highlighting --- test/test_php_handler.vader | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/test_php_handler.vader') diff --git a/test/test_php_handler.vader b/test/test_php_handler.vader index 11bb2d53..dd2d4664 100644 --- a/test/test_php_handler.vader +++ b/test/test_php_handler.vader @@ -53,7 +53,7 @@ Execute(The php handler should find columns correctly): AssertEqual \ [ - \ {'group': 'ALEError', 'id': 4, 'pos1': [2, 12, 1], 'priority': 10}, - \ {'group': 'ALEError', 'id': 5, 'pos1': [2, 12, 1], 'priority': 10} + \ {'group': 'ALEError', 'pos1': [2, 12, 1]}, + \ {'group': 'ALEError', 'pos1': [2, 12, 1]} \ ], - \ getmatches() + \ map(getmatches(), '{''group'': v:val.group, ''pos1'': v:val.pos1}') -- cgit v1.2.3 From cca0222cf1c54d14f4eaf24288cd8227fea78ffe Mon Sep 17 00:00:00 2001 From: Adriaan Zonnenberg Date: Sat, 18 Feb 2017 00:51:33 +0100 Subject: PHP: Make parser work with more error messages --- test/test_php_handler.vader | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test/test_php_handler.vader') diff --git a/test/test_php_handler.vader b/test/test_php_handler.vader index dd2d4664..537f24b5 100644 --- a/test/test_php_handler.vader +++ b/test/test_php_handler.vader @@ -30,13 +30,32 @@ Execute(The php handler should parse lines correctly): \ 'type': 'E', \ 'nr': -1, \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 5, + \ 'vcol': 0, + \ 'col': 0, + \ 'text': "Invalid numeric literal", + \ 'type': 'E', + \ 'nr': -1, + \ }, + \ { + \ 'bufnr': 347, + \ 'lnum': 21, + \ 'vcol': 0, + \ 'col': 0, + \ 'text': "syntax error, unexpected end of file", + \ 'type': 'E', + \ 'nr': -1, + \ }, \ ], \ ale_linters#php#php#Handle(347, [ \ 'This line should be ignored completely', \ "PHP Parse error: syntax error, unexpected ';', expecting ']' in - on line 47", \ "PHP Parse error: syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST) in - on line 56", - \ 'This line should be ignored completely', \ "PHP Parse error: syntax error, unexpected ')' in - on line 13", + \ 'PHP Parse error: Invalid numeric literal in - on line 5', + \ 'PHP Parse error: syntax error, unexpected end of file in - on line 21', \ ]) After: -- cgit v1.2.3