UltiSnips/test/test_Plugin.py

97 lines
3.4 KiB
Python
Raw Normal View History

2014-07-24 02:18:12 -04:00
import sys
from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
2015-01-20 15:26:03 -05:00
PYTHON3 = sys.version_info >= (3, 0)
2014-07-24 02:18:12 -04:00
def python3():
if PYTHON3:
2015-01-20 15:26:03 -05:00
return 'Test does not work on python3.'
2014-07-24 02:18:12 -04:00
# Plugin: YouCompleteMe {{{#
2014-08-02 08:55:27 -04:00
# TODO(sirver): disabled because it fails right now.
# class Plugin_YouCompleteMe_IntegrationTest(_VimTest):
# def skip_if(self):
# r = python3()
# if r:
2015-01-20 15:26:03 -05:00
# return r
2014-08-02 08:55:27 -04:00
# if "7.4" not in self.version:
2015-01-20 15:26:03 -05:00
# return "Needs Vim 7.4."
2014-08-02 08:55:27 -04:00
# plugins = ["Valloric/YouCompleteMe"]
# snippets = ("superlongtrigger", "Hello")
# keys = "superlo\ty"
# wanted = "Hello"
2014-08-02 08:55:27 -04:00
# def _extra_options_pre_init(self, vim_config):
# # Not sure why, but I need to make a new tab for this to work.
# vim_config.append('let g:UltiSnipsExpandTrigger="y"')
# vim_config.append('tabnew')
2014-08-02 08:55:27 -04:00
# def _before_test(self):
# self.vim.send(":set ft=python\n")
# # Give ycm a chance to catch up.
# time.sleep(1)
# End: Plugin: YouCompleteMe #}}}
# Plugin: Neocomplete {{{#
# TODO(sirver): disabled because it fails right now.
# class Plugin_Neocomplete_BugTest(_VimTest):
# Test for https://github.com/SirVer/ultisnips/issues/228
2015-01-20 15:26:03 -05:00
# def skip_if(self):
# if '+lua' not in self.version:
# return 'Needs +lua'
# plugins = ['Shougo/neocomplete.vim']
# snippets = ('t', 'Hello', '', 'w')
# keys = 'iab\\ t' + EX
# wanted = 'iab\\ Hello'
# def _extra_options_pre_init(self, vim_config):
# vim_config.append(r'set iskeyword+=\\ ')
# vim_config.append('let g:neocomplete#enable_at_startup = 1')
# vim_config.append('let g:neocomplete#enable_smart_case = 1')
# vim_config.append('let g:neocomplete#enable_camel_case = 1')
# vim_config.append('let g:neocomplete#enable_auto_delimiter = 1')
# vim_config.append('let g:neocomplete#enable_refresh_always = 1')
# End: Plugin: Neocomplete #}}}
# Plugin: unite {{{#
2015-01-20 15:26:03 -05:00
class Plugin_unite_BugTest(_VimTest):
2015-01-20 15:26:03 -05:00
plugins = ['Shougo/unite.vim']
snippets = ('t', 'Hello', '', 'w')
keys = 'iab\\ t=UltiSnipsCallUnite()\n'
wanted = 'iab\\ Hello '
def _extra_options_pre_init(self, vim_config):
vim_config.append(r'set iskeyword+=\\ ')
vim_config.append('function! UltiSnipsCallUnite()')
2015-01-20 15:26:03 -05:00
vim_config.append(
' Unite -start-insert -winheight=100 -immediately -no-empty ultisnips')
vim_config.append(' return ""')
vim_config.append('endfunction')
# End: Plugin: unite #}}}
# Plugin: Supertab {{{#
2015-01-20 15:26:03 -05:00
class Plugin_SuperTab_SimpleTest(_VimTest):
2015-01-20 15:26:03 -05:00
plugins = ['ervandew/supertab']
snippets = ('long', 'Hello', '', 'w')
keys = ('longtextlongtext\n' +
'longt' + EX + '\n' + # Should complete word
'long' + EX) # Should expand
wanted = 'longtextlongtext\nlongtextlongtext\nHello'
def _before_test(self):
# Make sure that UltiSnips has the keymap
2015-01-20 15:26:03 -05:00
self.vim.send(':call UltiSnips#map_keys#MapKeys()\n')
def _extra_options_post_init(self, vim_config):
2015-01-20 15:26:03 -05:00
assert EX == '\t' # Otherwise this test needs changing.
vim_config.append('let g:SuperTabDefaultCompletionType = "<c-p>"')
vim_config.append('let g:SuperTabRetainCompletionDuration = "insert"')
vim_config.append('let g:SuperTabLongestHighlight = 1')
vim_config.append('let g:SuperTabCrMapping = 0')
# End: Plugin: Supertab #}}}