summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-01-23 16:05:26 +0900
committerGitHub <noreply@github.com>2021-01-23 16:05:26 +0900
commita6dfc611f6694e183c6b22a40b1064156b4603cf (patch)
tree56747c7c2181a9769ea6bfb2ed17e16b9cb61116 /test
parent3c3dcd40412f593d315383e6c2ca898fc8fb7dc4 (diff)
parentd7ed80346c2cc9ddf9d72a075d5516d24708034a (diff)
downloadale-a6dfc611f6694e183c6b22a40b1064156b4603cf.zip
Merge pull request #3424 from maxice8/atools
Add support for Alpine Linux APKBUILD
Diffstat (limited to 'test')
-rw-r--r--test/handler/test_atools_handler.vader85
-rw-r--r--test/test_filetype_linter_defaults.vader7
2 files changed, 92 insertions, 0 deletions
diff --git a/test/handler/test_atools_handler.vader b/test/handler/test_atools_handler.vader
new file mode 100644
index 00000000..1bb9ca00
--- /dev/null
+++ b/test/handler/test_atools_handler.vader
@@ -0,0 +1,85 @@
+Before:
+ runtime autoload/ale/handlers/atools.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The atools handler should handle basic errors or warings):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 2,
+ \ 'text': 'trailing whitespace',
+ \ 'type': 'E',
+ \ 'code': 'AL8',
+ \ },
+ \ {
+ \ 'lnum': 15,
+ \ 'text': '$pkgname should not be used in the source url',
+ \ 'type': 'W',
+ \ 'code': 'AL29',
+ \ },
+ \ ],
+ \ ale#handlers#atools#Handle(bufnr(''), [
+ \ 'IC:[AL8]:APKBUILD:2:trailing whitespace',
+ \ 'MC:[AL29]:APKBUILD:15:$pkgname should not be used in the source url',
+ \ ])
+
+" Regardless of the severity, if the certainty is [P]ossible and not [C]ertain
+" or if regardless of the Certainity the Severity is not [I]mportant or [S]erious
+" then it must be a [W]arning
+Execute(If we are not Certain or Importantly Serious, be a Warning):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 3,
+ \ 'text': 'This violation is Serious but Possible false positive, I am a Warning!',
+ \ 'type': 'W',
+ \ 'code': 'AL',
+ \ },
+ \ {
+ \ 'lnum': 4,
+ \ 'text': 'This violation is Important but Possible false positive, I am a Warning!',
+ \ 'type': 'W',
+ \ 'code': 'AL',
+ \ },
+ \ {
+ \ 'lnum': 5,
+ \ 'text': 'This violation is Minor, I am a Warning!',
+ \ 'type': 'W',
+ \ 'code': 'AL',
+ \ },
+ \ {
+ \ 'lnum': 6,
+ \ 'text': 'This violation is Style, I am a Warning!',
+ \ 'type': 'W',
+ \ 'code': 'AL',
+ \ },
+ \ ],
+ \ ale#handlers#atools#Handle(bufnr(''), [
+ \ 'SP:[AL]:APKBUILD:3:This violation is Serious but Possible false positive, I am a Warning!',
+ \ 'IP:[AL]:APKBUILD:4:This violation is Important but Possible false positive, I am a Warning!',
+ \ 'MC:[AL]:APKBUILD:5:This violation is Minor, I am a Warning!',
+ \ 'TC:[AL]:APKBUILD:6:This violation is Style, I am a Warning!',
+ \ ])
+
+Execute(We should be error if we are Certain it is Serious or Important):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 7,
+ \ 'text': 'This is Certainly Serious, I am an Error!',
+ \ 'type': 'E',
+ \ 'code': 'AL',
+ \ },
+ \ {
+ \ 'lnum': 8,
+ \ 'text': 'This is Certainly Important, I am an Error!',
+ \ 'type': 'E',
+ \ 'code': 'AL',
+ \ },
+ \ ],
+ \ ale#handlers#atools#Handle(bufnr(''), [
+ \ 'SC:[AL]:APKBUILD:7:This is Certainly Serious, I am an Error!',
+ \ 'IC:[AL]:APKBUILD:8:This is Certainly Important, I am an Error!',
+ \ ])
diff --git a/test/test_filetype_linter_defaults.vader b/test/test_filetype_linter_defaults.vader
index e9980536..d4e708ec 100644
--- a/test/test_filetype_linter_defaults.vader
+++ b/test/test_filetype_linter_defaults.vader
@@ -70,3 +70,10 @@ Execute(The defaults for the verilog filetype should be correct):
Execute(Default aliases for React should be defined):
AssertEqual ['javascript', 'jsx'], ale#linter#ResolveFiletype('javascriptreact')
AssertEqual ['typescript', 'tsx'], ale#linter#ResolveFiletype('typescriptreact')
+
+Execute(The defaults for the apkbuild filetype should be correct):
+ AssertEqual ['apkbuild_lint', 'secfixes_check'], GetLinterNames('apkbuild')
+
+ let g:ale_linters_explicit = 1
+
+ AssertEqual [], GetLinterNames('apkbuild')