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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
|
from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
class Visual_NoVisualSelection_Ignore(_VimTest):
snippets = ("test", "h${VISUAL}b")
keys = "test" + EX + "abc"
wanted = "hbabc"
class Visual_SelectOneWord(_VimTest):
snippets = ("test", "h${VISUAL}b")
keys = "blablub" + ESC + "0v6l" + EX + "test" + EX
wanted = "hblablubb"
class Visual_SelectOneWordInclusive(_VimTest):
snippets = ("test", "h${VISUAL}b", "", "i")
keys = "xxxyyyyxxx" + ESC + "4|vlll" + EX + "test" + EX
wanted = "xxxhyyyybxxx"
class Visual_SelectOneWordExclusive(_VimTest):
snippets = ("test", "h${VISUAL}b", "", "i")
keys = "xxxyyyyxxx" + ESC + "4|vlll" + EX + "test" + EX
wanted = "xxxhyyybyxxx"
def _extra_vim_config(self, vim_config):
vim_config.append("set selection=exclusive")
class Visual_SelectOneWord_ProblemAfterTab(_VimTest):
snippets = ("test", "h${VISUAL}b", "", "i")
keys = "\tblablub" + ESC + "5hv3l" + EX + "test" + EX
wanted = "\tbhlablbub"
class VisualWithDefault_ExpandWithoutVisual(_VimTest):
snippets = ("test", "h${VISUAL:world}b")
keys = "test" + EX + "hi"
wanted = "hworldbhi"
class VisualWithDefaultWithSlashes_ExpandWithoutVisual(_VimTest):
snippets = ("test", r"h${VISUAL:\/\/ body}b")
keys = "test" + EX + "hi"
wanted = "h// bodybhi"
class VisualWithDefault_ExpandWithVisual(_VimTest):
snippets = ("test", "h${VISUAL:world}b")
keys = "blablub" + ESC + "0v6l" + EX + "test" + EX
wanted = "hblablubb"
class Visual_ExpandTwice(_VimTest):
snippets = ("test", "h${VISUAL}b")
keys = "blablub" + ESC + "0v6l" + EX + "test" + EX + "\ntest" + EX
wanted = "hblablubb\nhb"
class Visual_SelectOneWord_TwiceVisual(_VimTest):
snippets = ("test", "h${VISUAL}b${VISUAL}a")
keys = "blablub" + ESC + "0v6l" + EX + "test" + EX
wanted = "hblablubbblabluba"
class Visual_SelectOneWord_Inword(_VimTest):
snippets = ("test", "h${VISUAL}b", "Description", "i")
keys = "blablub" + ESC + "0lv4l" + EX + "test" + EX
wanted = "bhlablubb"
class Visual_SelectOneWord_TillEndOfLine(_VimTest):
snippets = ("test", "h${VISUAL}b", "Description", "i")
keys = "blablub" + ESC + "0v$" + EX + "test" + EX + ESC + "o"
wanted = "hblablub\nb"
class Visual_SelectOneWordWithTabstop_TillEndOfLine(_VimTest):
snippets = ("test", "h${2:ahh}${VISUAL}${1:ups}b", "Description", "i")
keys = (
"blablub"
+ ESC
+ "0v$"
+ EX
+ "test"
+ EX
+ "mmm"
+ JF
+ "n"
+ JF
+ "done"
+ ESC
+ "o"
)
wanted = "hnblablub\nmmmbdone"
class Visual_InDefaultText_SelectOneWord_NoOverwrite(_VimTest):
snippets = ("test", "h${1:${VISUAL}}b")
keys = "blablub" + ESC + "0v6l" + EX + "test" + EX + JF + "hello"
wanted = "hblablubbhello"
class Visual_InDefaultText_SelectOneWord(_VimTest):
snippets = ("test", "h${1:${VISUAL}}b")
keys = "blablub" + ESC + "0v6l" + EX + "test" + EX + "hello"
wanted = "hhellob"
class Visual_CrossOneLine(_VimTest):
snippets = ("test", "h${VISUAL}b")
keys = "bla blub\n helloi" + ESC + "0k4lvjll" + EX + "test" + EX
wanted = "bla hblub\n hellobi"
class Visual_LineSelect_Simple(_VimTest):
snippets = ("test", "h${VISUAL}b")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX
wanted = "hhello\n nice\n worldb"
class Visual_InDefaultText_LineSelect_NoOverwrite(_VimTest):
snippets = ("test", "h${1:bef${VISUAL}aft}b")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX + JF + "hi"
wanted = "hbefhello\n nice\n worldaftbhi"
class Visual_InDefaultText_LineSelect_Overwrite(_VimTest):
snippets = ("test", "h${1:bef${VISUAL}aft}b")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX + "jup" + JF + "hi"
wanted = "hjupbhi"
class Visual_LineSelect_CheckIndentSimple(_VimTest):
snippets = ("test", "beg\n\t${VISUAL}\nend")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX
wanted = "beg\n\thello\n\tnice\n\tworld\nend"
class Visual_LineSelect_CheckIndentTwice(_VimTest):
snippets = ("test", "beg\n\t${VISUAL}\nend")
keys = " hello\n nice\n\tworld" + ESC + "Vkk" + EX + "test" + EX
wanted = "beg\n\t hello\n\t nice\n\t\tworld\nend"
class Visual_InDefaultText_IndentSpacesToTabstop_NoOverwrite(_VimTest):
snippets = ("test", "h${1:beforea${VISUAL}aft}b")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX + JF + "hi"
wanted = "hbeforeahello\n\tnice\n\tworldaftbhi"
class Visual_InDefaultText_IndentSpacesToTabstop_Overwrite(_VimTest):
snippets = ("test", "h${1:beforea${VISUAL}aft}b")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX + "ups" + JF + "hi"
wanted = "hupsbhi"
class Visual_InDefaultText_IndentSpacesToTabstop_NoOverwrite1(_VimTest):
snippets = ("test", "h${1:beforeaaa${VISUAL}aft}b")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX + JF + "hi"
wanted = "hbeforeaaahello\n\t nice\n\t worldaftbhi"
class Visual_InDefaultText_IndentBeforeTabstop_NoOverwrite(_VimTest):
snippets = ("test", "hello\n\t ${1:${VISUAL}}\nend")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX + JF + "hi"
wanted = "hello\n\t hello\n\t nice\n\t world\nendhi"
class Visual_LineSelect_WithTabStop(_VimTest):
snippets = ("test", "beg\n\t${VISUAL}\n\t${1:here_we_go}\nend")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX + "super" + JF + "done"
wanted = "beg\n\thello\n\tnice\n\tworld\n\tsuper\nenddone"
class Visual_LineSelect_CheckIndentWithTS_NoOverwrite(_VimTest):
snippets = ("test", "beg\n\t${0:${VISUAL}}\nend")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX
wanted = "beg\n\thello\n\tnice\n\tworld\nend"
class Visual_LineSelect_DedentLine(_VimTest):
snippets = ("if", "if {\n\t${VISUAL}$0\n}")
keys = (
"if"
+ EX
+ "one\n\ttwo\n\tthree"
+ ESC
+ ARR_U * 2
+ "V"
+ ARR_D
+ EX
+ "\tif"
+ EX
)
wanted = "if {\n\tif {\n\t\tone\n\t\ttwo\n\t}\n\tthree\n}"
class VisualTransformation_SelectOneWord(_VimTest):
snippets = ("test", r"h${VISUAL/./\U$0\E/g}b")
keys = "blablub" + ESC + "0v6l" + EX + "test" + EX
wanted = "hBLABLUBb"
class VisualTransformationWithDefault_ExpandWithoutVisual(_VimTest):
snippets = ("test", r"h${VISUAL:world/./\U$0\E/g}b")
keys = "test" + EX + "hi"
wanted = "hWORLDbhi"
class VisualTransformationWithDefault_ExpandWithVisual(_VimTest):
snippets = ("test", r"h${VISUAL:world/./\U$0\E/g}b")
keys = "blablub" + ESC + "0v6l" + EX + "test" + EX
wanted = "hBLABLUBb"
class VisualTransformation_LineSelect_Simple(_VimTest):
snippets = ("test", r"h${VISUAL/./\U$0\E/g}b")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX
wanted = "hHELLO\n NICE\n WORLDb"
class VisualTransformation_InDefaultText_LineSelect_NoOverwrite(_VimTest):
snippets = ("test", r"h${1:bef${VISUAL/./\U$0\E/g}aft}b")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX + JF + "hi"
wanted = "hbefHELLO\n NICE\n WORLDaftbhi"
class VisualTransformation_InDefaultText_LineSelect_Overwrite(_VimTest):
snippets = ("test", r"h${1:bef${VISUAL/./\U$0\E/g}aft}b")
keys = "hello\nnice\nworld" + ESC + "Vkk" + EX + "test" + EX + "jup" + JF + "hi"
wanted = "hjupbhi"
|