diff options
author | w0rp <devw0rp@gmail.com> | 2017-06-06 23:13:53 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-06-06 23:13:53 +0100 |
commit | f30652a98f6c350ca02dde8d43c9eaafb1ac9f18 (patch) | |
tree | b852c4241b3051bf0a6a84f6b9bd16517e258e92 /test/test_ale_fix.vader | |
parent | e4d886d4a798208d2c5dd10816cd3f47a8f5f431 (diff) | |
download | ale-f30652a98f6c350ca02dde8d43c9eaafb1ac9f18.zip |
Allow ALEFix functions to be defined with only the buffer argument
Diffstat (limited to 'test/test_ale_fix.vader')
-rw-r--r-- | test/test_ale_fix.vader | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/test_ale_fix.vader b/test/test_ale_fix.vader index 5421dcfc..0974d10b 100644 --- a/test/test_ale_fix.vader +++ b/test/test_ale_fix.vader @@ -35,6 +35,10 @@ Before: return {'command': 'cat - <(echo d)'} endfunction + function CatLineOneArg(buffer) abort + return {'command': 'cat - <(echo d)'} + endfunction + function ReplaceWithTempFile(buffer, lines) abort return {'command': 'echo x > %t', 'read_temporary_file': 1} endfunction @@ -43,6 +47,10 @@ Before: return ['a', 'b'] endfunction + function RemoveLastLineOneArg(buffer) abort + return ['a', 'b'] + endfunction + function! TestCallback(buffer, output) return [{'lnum': 1, 'col': 1, 'text': 'xxx'}] endfunction @@ -65,8 +73,10 @@ After: delfunction AddDollars delfunction DoNothing delfunction CatLine + delfunction CatLineOneArg delfunction ReplaceWithTempFile delfunction RemoveLastLine + delfunction RemoveLastLineOneArg delfunction TestCallback delfunction SetUpLinters call ale#fix#registry#ResetToDefaults() @@ -315,3 +325,21 @@ Execute(ale#fix#InitBufferData() should set up the correct data): \ 'should_save': 1, \ }, \}, g:ale_fix_buffer_data + +Execute(ALEFix simple functions should be able to accept one argument, the buffer): + let g:ale_fixers.testft = ['RemoveLastLineOneArg'] + ALEFix + +Expect(There should be only two lines): + a + b + +Execute(ALEFix functions returning jobs should be able to accept one argument): + let g:ale_fixers.testft = ['CatLine'] + ALEFix + +Expect(An extra line should be added): + a + b + c + d |