diff options
author | Horacio Sanson <hsanson@gmail.com> | 2021-01-23 16:00:45 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-23 16:00:45 +0900 |
commit | 3c3dcd40412f593d315383e6c2ca898fc8fb7dc4 (patch) | |
tree | 0d1301fb2bfb49ce9c1bd2de3184645583d64414 /test/handler | |
parent | c37473630189a597f20016d11ba3ba1ae0bd6923 (diff) | |
parent | 66b3e768db55b0c03fa34310a5c79bbd24209694 (diff) | |
download | ale-3c3dcd40412f593d315383e6c2ca898fc8fb7dc4.zip |
Merge pull request #3489 from t2h5/yaml-spectral-linter
Add Stoplight Spectral linter for yaml
Diffstat (limited to 'test/handler')
-rw-r--r-- | test/handler/test_spectral_handler.vader | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/handler/test_spectral_handler.vader b/test/handler/test_spectral_handler.vader new file mode 100644 index 00000000..89a3ff1b --- /dev/null +++ b/test/handler/test_spectral_handler.vader @@ -0,0 +1,52 @@ +Before: + runtime ale_linters/yaml/spectral.vim + +After: + call ale#linter#Reset() + +Execute(spectral handler should parse lines correctly): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'code': 'oas3-api-servers', + \ 'text': 'OpenAPI `servers` must be present and non-empty array.', + \ 'type': 'W' + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'code': 'oas3-schema', + \ 'text': 'Object should have required property `paths`.', + \ 'type': 'E' + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'code': 'openapi-tags', + \ 'text': 'OpenAPI object should have non-empty `tags` array.', + \ 'type': 'W' + \ }, + \ { + \ 'lnum': 3, + \ 'col': 6, + \ 'code': 'info-contact', + \ 'text': 'Info object should contain `contact` object.', + \ 'type': 'W' + \ }, + \ { + \ 'lnum': 3, + \ 'col': 6, + \ 'code': 'oas3-schema', + \ 'text': '`info` property should have required property `version`.', + \ 'type': 'E' + \ }, + \ ], + \ ale#handlers#spectral#HandleSpectralOutput(bufnr(''), [ + \ 'openapi.yml:1:1 warning oas3-api-servers "OpenAPI `servers` must be present and non-empty array."', + \ 'openapi.yml:1:1 error oas3-schema "Object should have required property `paths`."', + \ 'openapi.yml:1:1 warning openapi-tags "OpenAPI object should have non-empty `tags` array."', + \ 'openapi.yml:3:6 warning info-contact "Info object should contain `contact` object."', + \ 'openapi.yml:3:6 error oas3-schema "`info` property should have required property `version`."', + \ ]) |