Skip to content

Commit 37f6413

Browse files
committed
nvim: add UserCommand testcase
Signed-off-by: Koichi Shiraishi <[email protected]>
1 parent 01a928e commit 37f6413

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

nvim/types_test.go

+31
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package nvim
22

33
import (
4+
"reflect"
45
"testing"
56
)
67

@@ -54,3 +55,33 @@ func TestLogLevel_String(t *testing.T) {
5455
})
5556
}
5657
}
58+
59+
func TestUserCommand(t *testing.T) {
60+
t.Parallel()
61+
62+
uc := reflect.TypeOf((*UserCommand)(nil)).Elem()
63+
64+
tests := map[string]struct {
65+
u UserCommand
66+
}{
67+
"UserVimCommand": {
68+
u: UserVimCommand(""),
69+
},
70+
"UserLuaCommand": {
71+
u: UserLuaCommand{},
72+
},
73+
}
74+
for name, tt := range tests {
75+
tt := tt
76+
t.Run(name, func(t *testing.T) {
77+
t.Parallel()
78+
79+
v := reflect.TypeOf(tt.u)
80+
if !v.Implements(uc) {
81+
t.Fatalf("%s type not implements %q interface", v.Name(), "UserCommand")
82+
}
83+
84+
tt.u.command()
85+
})
86+
}
87+
}

0 commit comments

Comments
 (0)