2014-07-19 11:45:44 -04:00
|
|
|
from test.vim_test_case import VimTestCase as _VimTest
|
|
|
|
from test.constant import *
|
|
|
|
|
|
|
|
# Test for bug 1251994 {{{#
|
2015-01-20 15:26:03 -05:00
|
|
|
|
|
|
|
|
2014-07-19 11:45:44 -04:00
|
|
|
class Bug1251994(_VimTest):
|
2015-01-20 15:26:03 -05:00
|
|
|
snippets = ('test', '${2:#2} ${1:#1};$0')
|
|
|
|
keys = ' test' + EX + 'hello' + JF + 'world' + JF + 'blub'
|
|
|
|
wanted = ' world hello;blub'
|
2014-07-19 11:45:44 -04:00
|
|
|
# End: 1251994 #}}}
|
|
|
|
|
|
|
|
# Test for https://github.com/SirVer/ultisnips/issues/157 (virtualedit) {{{#
|
2015-01-20 15:26:03 -05:00
|
|
|
|
|
|
|
|
2014-07-19 11:45:44 -04:00
|
|
|
class VirtualEdit(_VimTest):
|
2015-01-20 15:26:03 -05:00
|
|
|
snippets = ('pd', 'padding: ${1:0}px')
|
|
|
|
keys = '\t\t\tpd' + EX + '2'
|
|
|
|
wanted = '\t\t\tpadding: 2px'
|
2014-07-19 11:45:44 -04:00
|
|
|
|
2015-07-11 10:17:50 -04:00
|
|
|
def _extra_vim_config(self, vim_config):
|
2014-07-19 11:45:44 -04:00
|
|
|
vim_config.append('set virtualedit=all')
|
|
|
|
vim_config.append('set noexpandtab')
|
|
|
|
# End: 1251994 #}}}
|
|
|
|
|
|
|
|
# Test for Github Pull Request #134 - Retain unnamed register {{{#
|
2015-01-20 15:26:03 -05:00
|
|
|
|
|
|
|
|
2014-07-19 11:45:44 -04:00
|
|
|
class RetainsTheUnnamedRegister(_VimTest):
|
2015-01-20 15:26:03 -05:00
|
|
|
snippets = ('test', '${1:hello} ${2:world} ${0}')
|
|
|
|
keys = 'yank' + ESC + 'by4lea test' + EX + 'HELLO' + JF + JF + ESC + 'p'
|
|
|
|
wanted = 'yank HELLO world yank'
|
|
|
|
|
|
|
|
|
2014-07-19 11:45:44 -04:00
|
|
|
class RetainsTheUnnamedRegister_ButOnlyOnce(_VimTest):
|
2015-01-20 15:26:03 -05:00
|
|
|
snippets = ('test', '${1:hello} ${2:world} ${0}')
|
|
|
|
keys = 'blahfasel' + ESC + 'v' + 4 * ARR_L + \
|
|
|
|
'xotest' + EX + ESC + ARR_U + 'v0xo' + ESC + 'p'
|
|
|
|
wanted = '\nblah\nhello world '
|
2014-07-19 11:45:44 -04:00
|
|
|
# End: Github Pull Request # 134 #}}}
|
|
|
|
|
2014-10-08 13:30:40 -04:00
|
|
|
# Test to ensure that shiftwidth follows tabstop when it's set to zero post
|
|
|
|
# version 7.3.693. Prior to that version a shiftwidth of zero effectively
|
|
|
|
# removes tabs.
|
2015-01-20 15:26:03 -05:00
|
|
|
|
|
|
|
|
2014-10-08 13:30:40 -04:00
|
|
|
class ShiftWidthZero(_VimTest):
|
2015-01-20 15:26:03 -05:00
|
|
|
|
2015-07-11 10:17:50 -04:00
|
|
|
def _extra_vim_config(self, vim_config):
|
2015-01-20 15:26:03 -05:00
|
|
|
vim_config += [
|
|
|
|
"if exists('*shiftwidth')",
|
|
|
|
' set shiftwidth=0',
|
|
|
|
'endif',
|
|
|
|
]
|
|
|
|
snippets = ('test', '\t${1}${0}')
|
|
|
|
keys = 'test' + EX + 'foo'
|
|
|
|
wanted = '\tfoo'
|
2014-11-21 05:41:59 -05:00
|
|
|
|
|
|
|
# Test for https://github.com/SirVer/ultisnips/issues/171 {{{#
|
|
|
|
# Make sure that we don't crash when trying to save and restore the clipboard
|
|
|
|
# when it contains data that we can't coerce into Unicode.
|
2015-01-20 15:26:03 -05:00
|
|
|
|
|
|
|
|
2014-11-21 05:41:59 -05:00
|
|
|
class NonUnicodeDataInUnnamedRegister(_VimTest):
|
2015-01-20 15:26:03 -05:00
|
|
|
snippets = ('test', 'hello')
|
|
|
|
keys = 'test' + EX + ESC + \
|
|
|
|
'\n'.join([':redir @a',
|
|
|
|
':messages',
|
|
|
|
':redir END',
|
|
|
|
(":if match(@a, 'Error') != -1 | " +
|
|
|
|
"call setline('.', 'error detected') | " +
|
|
|
|
'3put a | ' +
|
|
|
|
'endif'),
|
|
|
|
''])
|
|
|
|
wanted = 'hello'
|
2014-11-21 05:41:59 -05:00
|
|
|
|
|
|
|
def _before_test(self):
|
|
|
|
# The string below was the one a user had on their clipboard when
|
|
|
|
# encountering the UnicodeDecodeError and could not be coerced into
|
|
|
|
# unicode.
|
2015-07-14 15:58:30 -04:00
|
|
|
self.vim.send_to_vim(
|
2015-01-20 15:26:03 -05:00
|
|
|
':let @" = "\\x80kdI{\\x80@7 1},' +
|
|
|
|
'\\x80kh\\x80kh\\x80kd\\x80kdq\\x80kb\\x1b"\n')
|
2014-11-21 05:41:59 -05:00
|
|
|
# End: #171 #}}}
|