UltiSnips/test/test_Expand.py

74 lines
2.1 KiB
Python
Raw Normal View History

from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
# Simple Expands {{{#
2015-01-20 15:26:03 -05:00
class _SimpleExpands(_VimTest):
2015-01-20 15:26:03 -05:00
snippets = ('hallo', 'Hallo Welt!')
class SimpleExpand_ExpectCorrectResult(_SimpleExpands):
2015-01-20 15:26:03 -05:00
keys = 'hallo' + EX
wanted = 'Hallo Welt!'
class SimpleExpandTwice_ExpectCorrectResult(_SimpleExpands):
2015-01-20 15:26:03 -05:00
keys = 'hallo' + EX + '\nhallo' + EX
wanted = 'Hallo Welt!\nHallo Welt!'
class SimpleExpandNewLineAndBackspae_ExpectCorrectResult(_SimpleExpands):
2015-01-20 15:26:03 -05:00
keys = 'hallo' + EX + '\nHallo Welt!\n\n\b\b\b\b\b'
wanted = 'Hallo Welt!\nHallo We'
def _extra_options_pre_init(self, vim_config):
2015-01-20 15:26:03 -05:00
vim_config.append('set backspace=eol,start')
class SimpleExpandTypeAfterExpand_ExpectCorrectResult(_SimpleExpands):
2015-01-20 15:26:03 -05:00
keys = 'hallo' + EX + 'and again'
wanted = 'Hallo Welt!and again'
class SimpleExpandTypeAndDelete_ExpectCorrectResult(_SimpleExpands):
2015-01-20 15:26:03 -05:00
keys = 'na du hallo' + EX + 'and again\b\b\b\b\bblub'
wanted = 'na du Hallo Welt!and blub'
class DoNotExpandAfterSpace_ExpectCorrectResult(_SimpleExpands):
2015-01-20 15:26:03 -05:00
keys = 'hallo ' + EX
wanted = 'hallo ' + EX
class ExitSnippetModeAfterTabstopZero(_VimTest):
2015-01-20 15:26:03 -05:00
snippets = ('test', 'SimpleText')
keys = 'test' + EX + EX
wanted = 'SimpleText' + EX
class ExpandInTheMiddleOfLine_ExpectCorrectResult(_SimpleExpands):
2015-01-20 15:26:03 -05:00
keys = 'Wie hallo gehts' + ESC + 'bhi' + EX
wanted = 'Wie Hallo Welt! gehts'
class MultilineExpand_ExpectCorrectResult(_VimTest):
2015-01-20 15:26:03 -05:00
snippets = ('hallo', 'Hallo Welt!\nUnd Wie gehts')
keys = 'Wie hallo gehts' + ESC + 'bhi' + EX
wanted = 'Wie Hallo Welt!\nUnd Wie gehts gehts'
class MultilineExpandTestTyping_ExpectCorrectResult(_VimTest):
2015-01-20 15:26:03 -05:00
snippets = ('hallo', 'Hallo Welt!\nUnd Wie gehts')
wanted = 'Wie Hallo Welt!\nUnd Wie gehtsHuiui! gehts'
keys = 'Wie hallo gehts' + ESC + 'bhi' + EX + 'Huiui!'
class SimpleExpandEndingWithNewline_ExpectCorrectResult(_VimTest):
2015-01-20 15:26:03 -05:00
snippets = ('hallo', 'Hallo Welt\n')
keys = 'hallo' + EX + '\nAnd more'
wanted = 'Hallo Welt\n\nAnd more'
# End: Simple Expands #}}}