]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/completion/test_complete_events.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 / completion / test_complete_events.vader
diff --git a/.vim/bundle/ale/test/completion/test_complete_events.vader b/.vim/bundle/ale/test/completion/test_complete_events.vader
new file mode 100644 (file)
index 0000000..cee1598
--- /dev/null
@@ -0,0 +1,35 @@
+Before:
+  let g:complete_post_triggered = 0
+
+  augroup VaderTest
+    autocmd!
+    autocmd User ALECompletePost let g:complete_post_triggered = 1
+  augroup END
+
+After:
+  unlet! b:ale_completion_info
+  unlet! g:complete_post_triggered
+
+  augroup VaderTest
+    autocmd!
+  augroup END
+
+  augroup! VaderTest
+
+Execute(ALECompletePost should not be triggered when completion is cancelled):
+  call ale#completion#HandleUserData({})
+
+  Assert !g:complete_post_triggered
+
+Execute(ALECompletePost should not be triggered when tools other than ALE insert completions):
+  call ale#completion#HandleUserData({'user_data': ''})
+  call ale#completion#HandleUserData({'user_data': '{}'})
+
+  Assert !g:complete_post_triggered
+
+Execute(ALECompletePost should be triggered when ALE inserts completions):
+  call ale#completion#HandleUserData({
+  \ 'user_data': json_encode({'_ale_completion_item': 1}),
+  \})
+
+  Assert g:complete_post_triggered