]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/fix/test_ale_fix_suggest.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / fix / test_ale_fix_suggest.vader
diff --git a/.vim/bundle/ale/test/fix/test_ale_fix_suggest.vader b/.vim/bundle/ale/test/fix/test_ale_fix_suggest.vader
new file mode 100644 (file)
index 0000000..1100aee
--- /dev/null
@@ -0,0 +1,102 @@
+Before:
+  call ale#fix#registry#Clear()
+
+  let g:buffer = bufnr('')
+
+  function GetSuggestions()
+    silent ALEFixSuggest
+
+    if bufnr('') != g:buffer
+      let l:lines = getline(1, '$')
+    else
+      let l:lines = []
+    endif
+
+    return l:lines
+  endfunction
+
+After:
+  if bufnr('') != g:buffer
+    :q!
+  endif
+
+  unlet! g:buffer
+
+  call ale#fix#registry#ResetToDefaults()
+  delfunction GetSuggestions
+
+Execute(ALEFixSuggest should return something sensible with no suggestions):
+  AssertEqual
+  \ [
+  \   'There is nothing in the registry to suggest.',
+  \   '',
+  \   'Press q to close this window',
+  \ ],
+  \ GetSuggestions()
+
+Execute(ALEFixSuggest should set the appropriate settings):
+  silent ALEFixSuggest
+
+  AssertEqual 'ale-fix-suggest', &filetype
+  Assert !&modified, 'The buffer was marked as modified'
+  Assert !&modifiable, 'The buffer was modifiable'
+
+Execute(ALEFixSuggest output should be correct for only generic handlers):
+  call ale#fix#registry#Add('zed', 'XYZ', [], 'Zedify things.')
+  call ale#fix#registry#Add('alpha', 'XYZ', [], 'Alpha things.')
+
+  AssertEqual
+  \ [
+  \   'Try the following generic fixers:',
+  \   '',
+  \   '''alpha'' - Alpha things.',
+  \   '''zed'' - Zedify things.',
+  \   '',
+  \   'See :help ale-fix-configuration',
+  \   '',
+  \   'Press q to close this window',
+  \ ],
+  \ GetSuggestions()
+
+Execute(ALEFixSuggest output should be correct for only filetype handlers):
+  let &filetype = 'testft2.testft'
+
+  call ale#fix#registry#Add('zed', 'XYZ', ['testft2'], 'Zedify things.')
+  call ale#fix#registry#Add('alpha', 'XYZ', ['testft'], 'Alpha things.')
+
+  AssertEqual
+  \ [
+  \   'Try the following fixers appropriate for the filetype:',
+  \   '',
+  \   '''alpha'' - Alpha things.',
+  \   '''zed'' - Zedify things.',
+  \   '',
+  \   'See :help ale-fix-configuration',
+  \   '',
+  \   'Press q to close this window',
+  \ ],
+  \ GetSuggestions()
+
+Execute(ALEFixSuggest should suggest filetype and generic handlers):
+  let &filetype = 'testft2.testft'
+
+  call ale#fix#registry#Add('zed', 'XYZ', ['testft2'], 'Zedify things.', ['foobar'])
+  call ale#fix#registry#Add('alpha', 'XYZ', ['testft'], 'Alpha things.')
+  call ale#fix#registry#Add('generic', 'XYZ', [], 'Generic things.')
+
+  AssertEqual
+  \ [
+  \   'Try the following fixers appropriate for the filetype:',
+  \   '',
+  \   '''alpha'' - Alpha things.',
+  \   '''zed'', ''foobar'' - Zedify things.',
+  \   '',
+  \   'Try the following generic fixers:',
+  \   '',
+  \   '''generic'' - Generic things.',
+  \   '',
+  \   'See :help ale-fix-configuration',
+  \   '',
+  \   'Press q to close this window',
+  \ ],
+  \ GetSuggestions()