File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed 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