diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/handler/test_asm_handler.vader | 8 | ||||
-rw-r--r-- | test/handler/test_coffeelint_handler.vader | 1 | ||||
-rw-r--r-- | test/handler/test_mypy_handler.vader | 2 | ||||
-rw-r--r-- | test/handler/test_nix_handler.vader | 2 | ||||
-rw-r--r-- | test/handler/test_php_handler.vader | 14 | ||||
-rw-r--r-- | test/handler/test_rubocop_handler.vader | 4 | ||||
-rw-r--r-- | test/handler/test_ruby_handler.vader | 3 | ||||
-rw-r--r-- | test/handler/test_shell_handler.vader | 12 | ||||
-rw-r--r-- | test/handler/test_slim_handler.vader | 3 | ||||
-rw-r--r-- | test/handler/test_typecheck_handler.vader | 4 | ||||
-rw-r--r-- | test/test_getmatches.vader | 148 |
11 files changed, 148 insertions, 53 deletions
diff --git a/test/handler/test_asm_handler.vader b/test/handler/test_asm_handler.vader index 7cee7783..2868628f 100644 --- a/test/handler/test_asm_handler.vader +++ b/test/handler/test_asm_handler.vader @@ -4,22 +4,14 @@ Execute(The asm GCC handler should parse lines from GCC 6.3.1 correctly): AssertEqual \ [ \ { - \ 'bufnr': 357, \ 'lnum': 38, - \ 'vcol': 0, - \ 'col': 0, \ 'text': "too many memory references for `mov'", \ 'type': 'E', - \ 'nr': -1, \ }, \ { - \ 'bufnr': 357, \ 'lnum': 42, - \ 'vcol': 0, - \ 'col': 0, \ 'text': "incorrect register `%ax' used with `l' suffix", \ 'type': 'E', - \ 'nr': -1, \ }, \ ], \ ale_linters#asm#gcc#Handle(357, [ diff --git a/test/handler/test_coffeelint_handler.vader b/test/handler/test_coffeelint_handler.vader index 10370221..4426e44e 100644 --- a/test/handler/test_coffeelint_handler.vader +++ b/test/handler/test_coffeelint_handler.vader @@ -4,7 +4,6 @@ Execute(The coffeelint handler should parse lines correctly): AssertEqual \ [ \ { - \ 'bufnr': 347, \ 'lnum': 125, \ 'text': "Line exceeds maximum allowed length Length is 122, max is 120.", \ 'type': 'E', diff --git a/test/handler/test_mypy_handler.vader b/test/handler/test_mypy_handler.vader index e161f8ae..77e678e4 100644 --- a/test/handler/test_mypy_handler.vader +++ b/test/handler/test_mypy_handler.vader @@ -4,14 +4,12 @@ Execute(The mypy handler should parse lines correctly): AssertEqual \ [ \ { - \ 'bufnr': 347, \ 'lnum': 4, \ 'col': 0, \ 'text': "No library stub file for module 'django.db'", \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 40, \ 'col': 5, \ 'text': "Some other problem", diff --git a/test/handler/test_nix_handler.vader b/test/handler/test_nix_handler.vader index a58c93de..1555e59d 100644 --- a/test/handler/test_nix_handler.vader +++ b/test/handler/test_nix_handler.vader @@ -4,14 +4,12 @@ Execute(The nix handler should parse nix-instantiate error messages correctly): AssertEqual \ [ \ { - \ 'bufnr': 47, \ 'lnum': 23, \ 'col': 14, \ 'text': 'error: syntax error, unexpected IN', \ 'type': 'E', \ }, \ { - \ 'bufnr': 47, \ 'lnum': 3, \ 'col': 12, \ 'text': 'error: syntax error, unexpected ''='', expecting '';''', diff --git a/test/handler/test_php_handler.vader b/test/handler/test_php_handler.vader index e7c5dc29..086a4f6a 100644 --- a/test/handler/test_php_handler.vader +++ b/test/handler/test_php_handler.vader @@ -11,53 +11,39 @@ Execute(The php handler should parse lines correctly): AssertEqual \ [ \ { - \ 'bufnr': 347, \ 'lnum': 1, \ 'col': 5, \ 'text': "syntax error, unexpected ';', expecting ']'", - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 2, \ 'col': 13, \ 'text': "syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST)", - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 3, \ 'col': 5, \ 'text': "syntax error, unexpected ')'", - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 4, \ 'col': 8, \ 'text': "syntax error, unexpected ''bar'' (T_CONSTANT_ENCAPSED_STRING), expecting ']'", - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 5, \ 'col': 0, \ 'text': "Cannot redeclare count()", - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 21, \ 'col': 0, \ 'text': "syntax error, unexpected end of file", - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 47, \ 'col': 0, \ 'text': "Invalid numeric literal", - \ 'type': 'E', \ }, \ ], \ ale_linters#php#php#Handle(347, [ diff --git a/test/handler/test_rubocop_handler.vader b/test/handler/test_rubocop_handler.vader index d77aa83c..8fa8374a 100644 --- a/test/handler/test_rubocop_handler.vader +++ b/test/handler/test_rubocop_handler.vader @@ -4,28 +4,24 @@ Execute(The rubocop handler should parse lines correctly): AssertEqual \ [ \ { - \ 'bufnr': 347, \ 'lnum': 83, \ 'col': 29, \ 'text': 'Prefer single-quoted strings...', \ 'type': 'W', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 12, \ 'col': 2, \ 'text': 'Some error', \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 10, \ 'col': 5, \ 'text': 'Regular warning', \ 'type': 'W', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 11, \ 'col': 1, \ 'text': 'Another error', diff --git a/test/handler/test_ruby_handler.vader b/test/handler/test_ruby_handler.vader index 573711f7..ed8b06e2 100644 --- a/test/handler/test_ruby_handler.vader +++ b/test/handler/test_ruby_handler.vader @@ -7,21 +7,18 @@ Execute(The ruby handler should parse lines correctly and add the column if it c \ [ \ { \ 'lnum': 6, - \ 'bufnr': 255, \ 'col': 13, \ 'type': 'E', \ 'text': 'syntax error, unexpected '';''' \ }, \ { \ 'lnum': 9, - \ 'bufnr': 255, \ 'col': 0, \ 'type': 'W', \ 'text': 'warning: statement not reached' \ }, \ { \ 'lnum': 12, - \ 'bufnr': 255, \ 'col': 0, \ 'type': 'E', \ 'text': 'syntax error, unexpected end-of-input, expecting keyword_end' diff --git a/test/handler/test_shell_handler.vader b/test/handler/test_shell_handler.vader index 12506821..ecfbf02b 100644 --- a/test/handler/test_shell_handler.vader +++ b/test/handler/test_shell_handler.vader @@ -7,40 +7,28 @@ Execute(The shell handler should parse lines correctly): AssertEqual \ [ \ { - \ 'bufnr': 347, \ 'lnum': 13, \ 'text': 'syntax error near unexpected token d', - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 7, \ 'text': 'line 42: line 36:', - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 11, \ 'text': 'Syntax error: "(" unexpected', - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 95, \ 'text': 'parse error near `out=$(( $1 / 1024. )...', - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 22, \ 'text': ':11: :33: :44:', - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 9, \ 'text': '`done'' unexpected', - \ 'type': 'E', \ }, \ ], \ ale_linters#sh#shell#Handle(347, [ diff --git a/test/handler/test_slim_handler.vader b/test/handler/test_slim_handler.vader index 12bd8183..21c1ec90 100644 --- a/test/handler/test_slim_handler.vader +++ b/test/handler/test_slim_handler.vader @@ -6,19 +6,16 @@ Execute(The slim handler should parse lines correctly): AssertEqual \ [ \ { - \ 'bufnr': 347, \ 'lnum': 1, \ 'text': 'RedundantDiv: `div` is redundant when class attribute shortcut is present', \ 'type': 'W', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 2, \ 'text': 'LineLength: Line is too long. [136/80]', \ 'type': 'W', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 3, \ 'text': 'Invalid syntax', \ 'type': 'E', diff --git a/test/handler/test_typecheck_handler.vader b/test/handler/test_typecheck_handler.vader index e42bcaf3..cf93798e 100644 --- a/test/handler/test_typecheck_handler.vader +++ b/test/handler/test_typecheck_handler.vader @@ -4,18 +4,14 @@ Execute(The typecheck handler should parse lines correctly): AssertEqual \ [ \ { - \ 'bufnr': 347, \ 'lnum': 16, \ 'col': 7, \ 'text': "Type 'A' is not assignable to type 'B'", - \ 'type': 'E', \ }, \ { - \ 'bufnr': 347, \ 'lnum': 7, \ 'col': 41, \ 'text': "Property 'a' does not exist on type 'A'", - \ 'type': 'E', \ }, \ ], \ ale_linters#typescript#typecheck#Handle(347, [ diff --git a/test/test_getmatches.vader b/test/test_getmatches.vader new file mode 100644 index 00000000..e728b571 --- /dev/null +++ b/test/test_getmatches.vader @@ -0,0 +1,148 @@ +Execute (ale#util#GetMatches should return matches for many lines): + AssertEqual + \ [ + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '47', + \ '14', + \ 'Missing trailing comma.', + \ 'Warning/comma-dangle', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ [ + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ '56', + \ '41', + \ 'Missing semicolon.', + \ 'Error/semi', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ ], + \ ale#util#GetMatches( + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ ], + \ [ + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$', + \ ] + \ ) + +Execute (ale#util#GetMatches should accept a string for a single pattern): + AssertEqual + \ [ + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '47', + \ '14', + \ 'Missing trailing comma.', + \ 'Warning/comma-dangle', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ [ + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ '56', + \ '41', + \ 'Missing semicolon.', + \ 'Error/semi', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ ], + \ ale#util#GetMatches( + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ ], + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$' + \ ) + +Execute (ale#util#GetMatches should accept a single line as a string): + AssertEqual + \ [ + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '47', + \ '14', + \ 'Missing trailing comma.', + \ 'Warning/comma-dangle', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ ], + \ ale#util#GetMatches( + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ [ + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$', + \ ] + \ ) + +Execute (ale#util#GetMatches should match multiple patterns correctly): + AssertEqual + \ [ + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '47', + \ '14', + \ 'Missing trailing comma.', + \ 'Warning/comma-dangle', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ [ + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ '56', + \ '41', + \ 'Missing semicolon.', + \ 'Error/semi', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ [ + \ '/path/to/some-filename.js:13:3: Parsing error: Unexpected token', + \ '13', + \ '3', + \ 'Parsing error: Unexpected token', + \ '', + \ '', + \ '', + \ '', + \ '', + \ '', + \ ], + \ ], + \ ale#util#GetMatches( + \ [ + \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]', + \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]', + \ '/path/to/some-filename.js:13:3: Parsing error: Unexpected token', + \ ], + \ [ + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$', + \ '^.*:\(\d\+\):\(\d\+\): \(.\+\)$', + \ ] + \ ) |