File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ def dec(f):
55
55
56
56
if range is not None :
57
57
opts ['range' ] = '' if range is True else str (range )
58
- elif count :
58
+ elif count is not None :
59
59
opts ['count' ] = count
60
60
61
61
if bang :
Original file line number Diff line number Diff line change
1
+ from nose .tools import with_setup , eq_ as eq , ok_ as ok
2
+
3
+ from neovim .plugin .decorators import command
4
+
5
+
6
+ def test_command_count ():
7
+ def function ():
8
+ "A dummy function to decorate."
9
+ return
10
+
11
+ # ensure absence with default value of None
12
+ decorated = command ('test' )(function )
13
+ ok ('count' not in decorated ._nvim_rpc_spec ['opts' ])
14
+
15
+ # ensure absence with explicit value of None
16
+ count_value = None
17
+ decorated = command ('test' , count = count_value )(function )
18
+ ok ('count' not in decorated ._nvim_rpc_spec ['opts' ])
19
+
20
+ # Test presesence with value of 0
21
+ count_value = 0
22
+ decorated = command ('test' , count = count_value )(function )
23
+ ok ('count' in decorated ._nvim_rpc_spec ['opts' ])
24
+ eq (decorated ._nvim_rpc_spec ['opts' ]['count' ], count_value )
25
+
26
+ # Test presence with value of 1
27
+ count_value = 1
28
+ decorated = command ('test' , count = count_value )(function )
29
+ ok ('count' in decorated ._nvim_rpc_spec ['opts' ])
30
+ eq (decorated ._nvim_rpc_spec ['opts' ]['count' ], count_value )
You can’t perform that action at this time.
0 commit comments