2014-07-24 02:18:12 -04:00
|
|
|
|
import sys
|
|
|
|
|
|
2014-07-19 11:45:44 -04:00
|
|
|
|
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
|
|
|
|
|
2014-07-19 11:45:44 -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-07-19 11:45:44 -04:00
|
|
|
|
|
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-07-19 11:45:44 -04:00
|
|
|
|
|
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)
|
2014-07-19 11:45:44 -04:00
|
|
|
|
# End: Plugin: YouCompleteMe #}}}
|
|
|
|
|
# Plugin: Neocomplete {{{#
|
2015-02-14 09:39:12 -05:00
|
|
|
|
# TODO(sirver): disabled because it fails right now.
|
|
|
|
|
# class Plugin_Neocomplete_BugTest(_VimTest):
|
2014-07-19 11:45:44 -04:00
|
|
|
|
# Test for https://github.com/SirVer/ultisnips/issues/228
|
2015-01-20 15:26:03 -05:00
|
|
|
|
|
2015-02-14 09:39:12 -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'
|
2014-07-19 11:45:44 -04:00
|
|
|
|
|
2015-02-14 09:39:12 -05:00
|
|
|
|
# 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')
|
2014-07-19 11:45:44 -04:00
|
|
|
|
# End: Plugin: Neocomplete #}}}
|
|
|
|
|
# Plugin: unite {{{#
|
2015-01-20 15:26:03 -05:00
|
|
|
|
|
|
|
|
|
|
2014-07-19 11:45:44 -04: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 '
|
2014-07-19 11:45:44 -04:00
|
|
|
|
|
|
|
|
|
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')
|
2014-07-19 11:45:44 -04:00
|
|
|
|
vim_config.append(' return ""')
|
|
|
|
|
vim_config.append('endfunction')
|
|
|
|
|
# End: Plugin: unite #}}}
|
|
|
|
|
# Plugin: Supertab {{{#
|
2015-01-20 15:26:03 -05:00
|
|
|
|
|
|
|
|
|
|
2014-07-19 11:45:44 -04: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'
|
2014-07-19 11:45:44 -04:00
|
|
|
|
|
|
|
|
|
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')
|
2014-07-19 11:45:44 -04:00
|
|
|
|
|
|
|
|
|
def _extra_options_post_init(self, vim_config):
|
2015-01-20 15:26:03 -05:00
|
|
|
|
assert EX == '\t' # Otherwise this test needs changing.
|
2014-07-19 11:45:44 -04:00
|
|
|
|
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 #}}}
|