This repository has been archived by the owner on Sep 21, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
merge.vimspec
127 lines (117 loc) · 3.61 KB
/
merge.vimspec
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
Describe gita#command#merge
Before all
let V = vital#of('vital')
let Path = V.import('System.Filepath')
let Guard = V.import('Vim.Guard')
let ScriptLocal = V.import('Vim.ScriptLocal')
" the line below is required to load requirements before :redir
silent Gita merge
End
Before
let sf = ScriptLocal.sfuncs(
\ Path.realpath('autoload/gita/command/merge.vim')
\)
let guard = Guard.store(['g:gita#process#options'])
let g:gita#process#options = {
\ 'clients': [deepcopy(V.import('System.Process.Mock'))],
\}
End
After
call guard.restore()
End
Describe s:args_from_options({git}, {options})
It returns a {args} List of {options}
new
let options = {
\ 'stat': 1,
\ 'no-stat': 1,
\ 'log': '10',
\ 'no-log': 1,
\ 'squash': 1,
\ 'no-squash': 1,
\ 'commit': 1,
\ 'no-commit': 1,
\ 'ff': 1,
\ 'no-ff': 1,
\ 'ff-only': 1,
\ 'rerere-autoupdate': 1,
\ 'no-rerere-autoupdate': 1,
\ 'verify-signatures': 1,
\ 'no-verify-signatures': 1,
\ 'strategy': ['A', 'B', 'C'],
\ 'strategy-option': 'A',
\ 'abort': 1,
\ 'gpg-sign': 1,
\ '__unknown__': [
\ 'a',
\ 'b',
\ ],
\}
let git = gita#core#get_or_fail()
let ret = sf.args_from_options(git, options)
Assert Equals(ret, [
\ 'merge',
\ '--no-edit',
\ '--verbose',
\ '--abort',
\ '--commit',
\ '--ff',
\ '--ff-only',
\ '--gpg-sign',
\ '--log=10',
\ '--no-commit',
\ '--no-ff',
\ '--no-log',
\ '--no-rerere-autoupdate',
\ '--no-squash',
\ '--no-stat',
\ '--no-verify-signatures',
\ '--rerere-autoupdate',
\ '--squash',
\ '--stat',
\ '--strategy=A', '--strategy=B', '--strategy=C',
\ '--strategy-option=A',
\ '--verify-signatures',
\ 'a', 'b',
\])
End
It ignores unknown attributes in {options}
let options = {
\ 'foobar': 1,
\}
let git = gita#core#get_or_fail()
let ret = sf.args_from_options(git, options)
Assert Equals(ret, [
\ 'merge',
\ '--no-edit',
\ '--verbose',
\])
End
End
Describe #command({bang}, {range}, {args})
It executes 'git merge --no-edit --verbose' for 'Gita merge'
redir => content
silent! verbose execute 'Gita merge'
redir END
Assert Match(content, 'git .* merge --no-edit --verbose')
End
It executes 'git merge --no-edit --verbose --stat' for 'Gita merge --stat'
redir => content
silent! verbose execute 'Gita merge --stat'
redir END
Assert Match(content, 'git .* merge --no-edit --verbose --stat')
End
It executes 'git merge --no-edit --verbose --log=10 --stat' for 'Gita merge --stat --log=10'
redir => content
silent! verbose execute 'Gita merge --stat --log=10'
redir END
Assert Match(content, 'git .* merge --no-edit --verbose --log=10 --stat')
End
It executes 'git merge --no-edit --verbose develop' for 'Gita merge develop'
redir => content
silent! verbose execute 'Gita merge develop'
redir END
Assert Match(content, 'git .* merge --no-edit --verbose develop')
End
End
End