diff options
author | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-08-29 10:42:25 +0200 |
---|---|---|
committer | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-08-29 10:42:25 +0200 |
commit | 0de847a8e1793b597ba0a73ae8e20797a5fce920 (patch) | |
tree | 6f465b404af38ff25dddde94e052bdfa0a3a38c8 /test/fix/test_ale_fix.vader | |
parent | 62f07d820c2b474216657bd43a3a919469c9584f (diff) | |
parent | 7d4ce4e6aa960a6052a16d90322566d6f4fddb7c (diff) | |
download | ale-0de847a8e1793b597ba0a73ae8e20797a5fce920.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'test/fix/test_ale_fix.vader')
-rw-r--r-- | test/fix/test_ale_fix.vader | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/fix/test_ale_fix.vader b/test/fix/test_ale_fix.vader index 53079d16..e8a9dd7a 100644 --- a/test/fix/test_ale_fix.vader +++ b/test/fix/test_ale_fix.vader @@ -6,6 +6,7 @@ Before: Save g:ale_lint_on_save Save g:ale_echo_cursor Save g:ale_command_wrapper + Save g:ale_filename_mappings silent! cd /testplugin/test/fix @@ -19,6 +20,7 @@ Before: let g:ale_fixers = { \ 'testft': [], \} + let g:ale_filename_mappings = {} let g:pre_success = 0 let g:post_success = 0 @@ -72,6 +74,10 @@ Before: return {'command': 'cat %t <(echo d)'} endfunction + function EchoFilename(buffer, lines) abort + return {'command': 'echo %s'} + endfunction + function RemoveLastLine(buffer, lines) abort return ['a', 'b'] endfunction @@ -155,6 +161,7 @@ After: delfunction CatLineDeferred delfunction ReplaceWithTempFile delfunction CatWithTempFile + delfunction EchoFilename delfunction RemoveLastLine delfunction RemoveLastLineOneArg delfunction TestCallback @@ -209,6 +216,25 @@ Expect(The first function should be used): ^b ^c +Execute(Should apply filename mpapings): + " The command echos %s, and we'll map the current path so we can check + " that ALEFix applies filename mappings, end-to-end. + let g:ale_filename_mappings = { + \ 'echo_filename': [ + \ [expand('%:p:h') . '/', '/some/fake/path/'], + \ ], + \} + + call ale#fix#registry#Add('echo_filename', 'EchoFilename', [], 'echo filename') + let g:ale_fixers.testft = ['echo_filename'] + ALEFix + call ale#test#FlushJobs() + " Remote trailing whitespace from the line. + call setline(1, substitute(getline(1), '[ \r]\+$', '', '')) + +Expect(The mapped filename should be printed): + /some/fake/path/test.txt + Execute(ALEFix should apply simple functions in a chain): let g:ale_fixers.testft = ['AddCarets', 'Capitalize'] ALEFix |