1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
class _AnonBase(_VimTest):
args = ""
def _extra_vim_config(self, vim_config):
vim_config.append(
"inoremap <silent> %s <C-R>=UltiSnips#Anon(%s)<cr>" % (EA, self.args)
)
class Anon_NoTrigger_Simple(_AnonBase):
args = '"simple expand"'
keys = "abc" + EA
wanted = "abcsimple expand"
class Anon_NoTrigger_AfterSpace(_AnonBase):
args = '"simple expand"'
keys = "abc " + EA
wanted = "abc simple expand"
class Anon_NoTrigger_BeginningOfLine(_AnonBase):
args = r"':latex:\`$1\`$0'"
keys = EA + "Hello" + JF + "World"
wanted = ":latex:`Hello`World"
class Anon_NoTrigger_FirstCharOfLine(_AnonBase):
args = r"':latex:\`$1\`$0'"
keys = " " + EA + "Hello" + JF + "World"
wanted = " :latex:`Hello`World"
class Anon_NoTrigger_Multi(_AnonBase):
args = '"simple $1 expand $1 $0"'
keys = "abc" + EA + "123" + JF + "456"
wanted = "abcsimple 123 expand 123 456"
class Anon_Trigger_Multi(_AnonBase):
args = '"simple $1 expand $1 $0", "abc"'
keys = "123 abc" + EA + "123" + JF + "456"
wanted = "123 simple 123 expand 123 456"
class Anon_Trigger_Simple(_AnonBase):
args = '"simple expand", "abc"'
keys = "abc" + EA
wanted = "simple expand"
class Anon_Trigger_Twice(_AnonBase):
args = '"simple expand", "abc"'
keys = "abc" + EA + "\nabc" + EX
wanted = "simple expand\nabc" + EX
class Anon_Trigger_Opts(_AnonBase):
args = '"simple expand", ".*abc", "desc", "r"'
keys = "blah blah abc" + EA
wanted = "simple expand"
|