diff options
author | Albert Peschar <albert@peschar.net> | 2023-03-07 02:31:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-07 01:31:14 +0000 |
commit | 6ae26df22b982e8b19824af96b3e937a0de0bf59 (patch) | |
tree | 2d996429f30131a3b3f0e13bf13a4feddd5ef234 /test | |
parent | c8e914604963063b7bb827e9b6f5a6ca741dad60 (diff) | |
download | ale-6ae26df22b982e8b19824af96b3e937a0de0bf59.zip |
Add deadnix linter (#4443)
Diffstat (limited to 'test')
-rw-r--r-- | test/handler/test_deadnix_handler.vader | 27 | ||||
-rw-r--r-- | test/linter/test_nix_deadnix.vader | 19 |
2 files changed, 46 insertions, 0 deletions
diff --git a/test/handler/test_deadnix_handler.vader b/test/handler/test_deadnix_handler.vader new file mode 100644 index 00000000..242af881 --- /dev/null +++ b/test/handler/test_deadnix_handler.vader @@ -0,0 +1,27 @@ +Execute(The deadnix handler should handle deadnix output): + let output = [ + \'{"file":"./flake.nix","results":[{"column":5,"endColumn":9,"line":23,"message":"Unused lambda pattern: self"},{"column":2,"endColumn":6,"line":1,"message":"Unused lambda pattern: pkgs"}]}' + \] + + AssertEqual + \ [ + \ { + \ 'lnum': 23, + \ 'col': 5, + \ 'end_col': 9, + \ 'text': 'Unused lambda pattern: self', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 2, + \ 'end_col': 6, + \ 'text': 'Unused lambda pattern: pkgs', + \ 'type': 'W', + \ }, + \ ], + \ ale#handlers#deadnix#Handle(bufnr(''), output) + + AssertEqual [], ale#handlers#deadnix#Handle(bufnr(''), ['']) + AssertEqual [], ale#handlers#deadnix#Handle(bufnr(''), ['not json']) + AssertEqual [], ale#handlers#deadnix#Handle(bufnr(''), ['{"results":[{}]}']) diff --git a/test/linter/test_nix_deadnix.vader b/test/linter/test_nix_deadnix.vader new file mode 100644 index 00000000..90416302 --- /dev/null +++ b/test/linter/test_nix_deadnix.vader @@ -0,0 +1,19 @@ +Before: + call ale#assert#SetUpLinterTest('nix', 'deadnix') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The deadnix command should be correct): + AssertLinter 'deadnix', ale#Escape('deadnix') . ' -o json -- %t' + +Execute(Additional deadnix options should be configurable): + let g:ale_nix_deadnix_options = '--foobar' + + AssertLinter 'deadnix', + \ ale#Escape('deadnix') . ' -o json --foobar -- %t' + +Execute(The deadnix command should be configurable): + let g:ale_nix_deadnix_executable = 'foo/bar' + + AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' -o json -- %t' |