diff options
author | Alex McKinney <alexmckinney01@gmail.com> | 2022-04-06 01:00:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-06 17:00:59 +0900 |
commit | 607f33a1b0f662d9809d54363e8e81a4965862ce (patch) | |
tree | 4795d8a2dd649f930202b93e25dadf4bd6f8402a /test | |
parent | 1e997580fdbb8e11e043af071c97d3aa879cf875 (diff) | |
download | ale-607f33a1b0f662d9809d54363e8e81a4965862ce.zip |
Add buf linter and fixer (#4128)
* Add buf lint to linters
* Add buf format to fixers
* Fix test/linter/test_buf_lint.vader
* Fix test/fixers/test_buf_format_fixer_callback.vader
* Simplify test/test-files/proto/testfile.proto
* Add buf-lint alias and rename linter
Diffstat (limited to 'test')
-rw-r--r-- | test/fixers/test_buf_format_fixer_callback.vader | 21 | ||||
-rw-r--r-- | test/linter/test_buf_lint.vader | 22 | ||||
-rw-r--r-- | test/test-files/proto/testfile.proto | 0 |
3 files changed, 43 insertions, 0 deletions
diff --git a/test/fixers/test_buf_format_fixer_callback.vader b/test/fixers/test_buf_format_fixer_callback.vader new file mode 100644 index 00000000..ee484820 --- /dev/null +++ b/test/fixers/test_buf_format_fixer_callback.vader @@ -0,0 +1,21 @@ +Before: + Save g:ale_proto_buf_format_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_proto_buf_format_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The buf-format callback should return the correct default values): + call ale#test#SetFilename('../test-files/proto/testfile.proto') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' format %t', + \ }, + \ ale#fixers#buf_format#Fix(bufnr('')) diff --git a/test/linter/test_buf_lint.vader b/test/linter/test_buf_lint.vader new file mode 100644 index 00000000..7b8bb52c --- /dev/null +++ b/test/linter/test_buf_lint.vader @@ -0,0 +1,22 @@ +Before: + call ale#assert#SetUpLinterTest('proto', 'buf_lint') + call ale#test#SetFilename('test.proto') + +After: + call ale#assert#TearDownLinterTest() + +Execute(The default command should be correct): + AssertLinter 'buf', + \ ale#Escape('buf') + \ . ' lint' + \ . ' %s#include_package_files=true' + +Execute(The callback should include any additional options): + let b:ale_proto_buf_lint_executable = '/tmp/buf' + let b:ale_proto_buf_lint_config = '/tmp/buf.yaml' + + AssertLinter '/tmp/buf', + \ ale#Escape('/tmp/buf') + \ . ' lint' + \ . ' --config=' . ale#Escape('/tmp/buf.yaml') + \ . ' %s#include_package_files=true' diff --git a/test/test-files/proto/testfile.proto b/test/test-files/proto/testfile.proto new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/test-files/proto/testfile.proto |