diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/handler/test_gcc_handler.vader | 26 | ||||
-rw-r--r-- | test/handler/test_gometalinter_handler.vader | 21 | ||||
-rw-r--r-- | test/handler/test_rust_handler.vader | 18 | ||||
-rw-r--r-- | test/test_line_join.vader | 64 |
4 files changed, 44 insertions, 85 deletions
diff --git a/test/handler/test_gcc_handler.vader b/test/handler/test_gcc_handler.vader index 2934bbee..72b7c541 100644 --- a/test/handler/test_gcc_handler.vader +++ b/test/handler/test_gcc_handler.vader @@ -94,29 +94,3 @@ Execute(The GCC handler shouldn't complain about #pragma once for headers): \ ale#handlers#gcc#HandleGCCFormat(347, [ \ '<stdin>:1:1: warning: #pragma once in main file [enabled by default]', \ ]) - -Execute(The GCC handler should eliminate duplicated clang errors): - AssertEqual - \ [ - \ {'lnum': 2, 'col': 10, 'type': 'E', 'text': '''a.h'' file not found'}, - \ {'lnum': 4, 'col': 10, 'type': 'E', 'text': 'empty filename'}, - \ ], - \ ale#handlers#gcc#HandleGCCFormat(347, [ - \ '<stdin>:2:10: fatal error: ''a.h'' file not found', - \ '#include "a.h"', - \ ' ^~~~~', - \ '', - \ '<stdin>:2:10: fatal error: ''a.h'' file not found', - \ '#include "a.h"', - \ ' ^~~~~', - \ '', - \ '<stdin>:4:10: error: empty filename', - \ '', - \ '<stdin>:4:10: error: empty filename', - \ '#include ""', - \ ' ^', - \ '', - \ '<stdin>:4:10: error: empty filename', - \ '#include ""', - \ ' ^', - \ ]) diff --git a/test/handler/test_gometalinter_handler.vader b/test/handler/test_gometalinter_handler.vader index 52a4fc96..603ba22d 100644 --- a/test/handler/test_gometalinter_handler.vader +++ b/test/handler/test_gometalinter_handler.vader @@ -51,24 +51,3 @@ Execute (The gometalinter handler should handle relative paths correctly): \ 'baz.go:12:3:warning: expected ''package'', found ''IDENT'' gibberish (staticcheck)', \ 'baz.go:37:5:error: expected ''package'', found ''IDENT'' gibberish (golint)', \ ]) - - -Execute (The gometalinter handler should filter out errors from other files): - silent file! /some/path/sql.go - - AssertEqual - \ [], - \ ale_linters#go#gometalinter#Handler(bufnr(''), [ - \ '/some/path/interface_implementation_test.go:417::warning: cyclomatic complexity 24 of function testGetUserHeaders() is high (> 10) (gocyclo)', - \ '/some/path/sql_helpers.go:38::warning: cyclomatic complexity 11 of function CreateTestUserMetadataDB() is high (> 10) (gocyclo)', - \ '/some/path/sql_alpha.go:560:7:warning: ineffectual assignment to err (ineffassign)', - \ '/some/path/sql_alpha.go:589:7:warning: ineffectual assignment to err (ineffassign)', - \ '/some/path/sql_test.go:124:9:warning: should not use basic type untyped string as key in context.WithValue (golint)', - \ '/some/path/interface_implementation_test.go:640::warning: declaration of "cfg" shadows declaration at sql_test.go:21 (vetshadow)', - \ '/some/path/sql_helpers.go:55::warning: declaration of "err" shadows declaration at sql_helpers.go:48 (vetshadow)', - \ '/some/path/sql_helpers.go:91::warning: declaration of "err" shadows declaration at sql_helpers.go:48 (vetshadow)', - \ '/some/path/sql_helpers.go:108::warning: declaration of "err" shadows declaration at sql_helpers.go:48 (vetshadow)', - \ '/some/path/user_metadata_db.go:149::warning: declaration of "err" shadows declaration at user_metadata_db.go:140 (vetshadow)', - \ '/some/path/user_metadata_db.go:188::warning: declaration of "err" shadows declaration at user_metadata_db.go:179 (vetshadow)', - \ '/some/path/queries_alpha.go:62::warning: Potential hardcoded credentials,HIGH,LOW (gas)', - \ ]) diff --git a/test/handler/test_rust_handler.vader b/test/handler/test_rust_handler.vader index 052d722b..3e0ed43d 100644 --- a/test/handler/test_rust_handler.vader +++ b/test/handler/test_rust_handler.vader @@ -46,21 +46,3 @@ Execute(The Rust handler should handle cargo output): \ '{"message":{"children":[],"code":null,"level":"error","message":"no method named `wat` found for type `std::string::String` in the current scope","rendered":null,"spans":[{"byte_end":11497,"byte_start":11494,"column_end":10,"column_start":7,"expansion":null,"file_name":"src/playpen.rs","is_primary":true,"label":null,"line_end":13,"line_start":13,"suggested_replacement":null,"text":[{"highlight_end":10,"highlight_start":7,"text":" s.wat()"}]}]},"package_id":"update 0.0.1 (path+file:///home/w0rp/Downloads/rust-by-example)","reason":"compiler-message","target":{"kind":["bin"],"name":"update","src_path":"/home/w0rp/Downloads/rust-by-example/src/main.rs"}}', \ '{"message":{"children":[],"code":null,"level":"error","message":"aborting due to previous error","rendered":null,"spans":[]},"package_id":"update 0.0.1 (path+file:///home/w0rp/Downloads/rust-by-example)","reason":"compiler-message","target":{"kind":["bin"],"name":"update","src_path":"/home/w0rp/Downloads/rust-by-example/src/main.rs"}}', \ ]) - -Execute(The Rust handler should handle JSON split over many lines): - AssertEqual - \ [ - \ { - \ 'lnum': 15, - \ 'type': 'E', - \ 'col': 11505, - \ 'text': 'expected one of `.`, `;`, `?`, `}`, or an operator, found `for`', - \ }, - \ ], - \ ale#handlers#rust#HandleRustErrorsForFile(347, 'src/playpen.rs', [ - \ '', - \ 'ignore this', - \ '{"message":{"children":[],"code":null,"level":"error","message":"expected one of `.`, `;`, `?`, `}`, or an operator, found `for`","rendered":null,"spans":[{"byte_end":11508,"byte_start":11505,"column_end":8,"column_start":5,"expansion":null', - \ ',"file_name":"src/playpen.rs","is_primary":true,"label":null,"line_end":15,"line_start":15,"suggested_replacement":null,', - \ '"text":[{"highlight_end":8,"highlight_start":5,"text":" for chr in source.trim().chars() {"}]}]},"package_id":"update 0.0.1 (path+file:///home/w0rp/Downloads/rust-by-example)","reason":"compiler-message","target":{"kind":["bin"],"name":"update","src_path":"/home/w0rp/Downloads/rust-by-example/src/main.rs"}}', - \ ]) diff --git a/test/test_line_join.vader b/test/test_line_join.vader index 63d8d338..389632b9 100644 --- a/test/test_line_join.vader +++ b/test/test_line_join.vader @@ -1,23 +1,47 @@ Before: - let g:test_output = [ - \ ['one', 'two', 'thr'], - \ ['ee', ''], - \ ['fou'], - \ [''], - \ ['r', 'five'], - \ [], - \ ['', 'six'] - \] - - let g:expected_result = ['one', 'two', 'three', 'four', 'five', 'six'] + let g:lines = [] + + function LineCallback(job_id, line) abort + call add(g:lines, a:line) + endfunction After: - unlet g:test_output - unlet g:expected_result - -Execute (Join the lines): - let joined_result = [] - for item in g:test_output - call ale#job#JoinNeovimOutput(joined_result, item) - endfor - AssertEqual g:expected_result, joined_result + unlet! g:last_line + unlet! g:lines + delfunction LineCallback + +Execute (ALE should pass on full lines for NeoVim): + let g:last_line = ale#job#JoinNeovimOutput(1, '', ['x', 'y', ''], function('LineCallback')) + + AssertEqual ['x', 'y'], g:lines + AssertEqual '', g:last_line + +Execute (ALE should pass on a single long line): + let g:last_line = ale#job#JoinNeovimOutput(1, '', ['x'], function('LineCallback')) + + AssertEqual [], g:lines + AssertEqual 'x', g:last_line + +Execute (ALE should handle just a single line of output): + let g:last_line = ale#job#JoinNeovimOutput(1, '', ['x', ''], function('LineCallback')) + + AssertEqual ['x'], g:lines + AssertEqual '', g:last_line + +Execute (ALE should join two incomplete pieces of large lines together): + let g:last_line = ale#job#JoinNeovimOutput(1, 'x', ['y'], function('LineCallback')) + + AssertEqual [], g:lines + AssertEqual 'xy', g:last_line + +Execute (ALE join incomplete lines, and set new ones): + let g:last_line = ale#job#JoinNeovimOutput(1, 'x', ['y', 'z', 'a'], function('LineCallback')) + + AssertEqual ['xy', 'z'], g:lines + AssertEqual 'a', g:last_line + +Execute (ALE join incomplete lines, and set new ones, with two elements): + let g:last_line = ale#job#JoinNeovimOutput(1, 'x', ['y', 'z'], function('LineCallback')) + + AssertEqual ['xy'], g:lines + AssertEqual 'z', g:last_line |