File: test_Expand.py

package info (click to toggle)
vim-ultisnips 3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,924 kB
  • sloc: python: 8,353; sh: 64; makefile: 38
file content (77 lines) | stat: -rw-r--r-- 2,316 bytes parent folder | download | duplicates (2)
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
from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *


class _SimpleExpands(_VimTest):
    snippets = ("hallo", "Hallo Welt!")


class SimpleExpand_ExpectCorrectResult(_SimpleExpands):
    keys = "hallo" + EX
    wanted = "Hallo Welt!"


class SimpleExpandTwice_ExpectCorrectResult(_SimpleExpands):
    keys = "hallo" + EX + "\nhallo" + EX
    wanted = "Hallo Welt!\nHallo Welt!"


class SimpleExpandNewLineAndBackspae_ExpectCorrectResult(_SimpleExpands):
    keys = "hallo" + EX + "\nHallo Welt!\n\n\b\b\b\b\b"
    wanted = "Hallo Welt!\nHallo We"

    def _extra_vim_config(self, vim_config):
        vim_config.append("set backspace=eol,start")


class SimpleExpandTypeAfterExpand_ExpectCorrectResult(_SimpleExpands):
    keys = "hallo" + EX + "and again"
    wanted = "Hallo Welt!and again"


class SimpleExpandTypeAndDelete_ExpectCorrectResult(_SimpleExpands):
    keys = "na du hallo" + EX + "and again\b\b\b\b\bblub"
    wanted = "na du Hallo Welt!and blub"


class DoNotExpandAfterSpace_ExpectCorrectResult(_SimpleExpands):
    keys = "hallo " + EX
    wanted = "hallo " + EX


class ExitSnippetModeAfterTabstopZero(_VimTest):
    snippets = ("test", "SimpleText")
    keys = "test" + EX + EX
    wanted = "SimpleText" + EX


class ExpandInTheMiddleOfLine_ExpectCorrectResult(_SimpleExpands):
    keys = "Wie hallo gehts" + ESC + "bhi" + EX
    wanted = "Wie Hallo Welt! gehts"


class MultilineExpand_ExpectCorrectResult(_VimTest):
    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):
    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):
    snippets = ("hallo", "Hallo Welt\n")
    keys = "hallo" + EX + "\nAnd more"
    wanted = "Hallo Welt\n\nAnd more"


class SimpleExpand_DoNotClobberDefaultRegister(_VimTest):
    snippets = ("hallo", "Hallo ${1:Welt}")
    keys = "hallo" + EX + BS + ESC + "o" + ESC + "P"
    wanted = "Hallo \n"

    def _extra_vim_config(self, vim_config):
        vim_config.append('let @"=""')