summaryrefslogtreecommitdiff
path: root/test/fix
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-08-23 19:55:42 +0100
committerw0rp <devw0rp@gmail.com>2020-08-23 19:55:42 +0100
commitba3dd0d02735e7b23918200ae58410b0deed2f62 (patch)
tree83012a41e42d746629fbf07293a1b3e7b7ed0fe6 /test/fix
parent2b785688ead505dcbc1007374d3dca9914aa247a (diff)
downloadale-ba3dd0d02735e7b23918200ae58410b0deed2f62.zip
Close #2556 - Support filename mapping
ALE now supports mapping files between different systems for running linters and fixers with Docker, in virtual machines, in servers, etc.
Diffstat (limited to 'test/fix')
-rw-r--r--test/fix/test_ale_fix.vader24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/fix/test_ale_fix.vader b/test/fix/test_ale_fix.vader
index 53079d16..ee96f0ff 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,23 @@ 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()
+
+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