From 37f6413db894a93ee7aa43ceafe771a8c13e9222 Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Wed, 19 Jan 2022 06:58:53 +0900 Subject: [PATCH] nvim: add UserCommand testcase Signed-off-by: Koichi Shiraishi --- nvim/types_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/nvim/types_test.go b/nvim/types_test.go index 9e4e35f1..0725cbf7 100644 --- a/nvim/types_test.go +++ b/nvim/types_test.go @@ -1,6 +1,7 @@ package nvim import ( + "reflect" "testing" ) @@ -54,3 +55,33 @@ func TestLogLevel_String(t *testing.T) { }) } } + +func TestUserCommand(t *testing.T) { + t.Parallel() + + uc := reflect.TypeOf((*UserCommand)(nil)).Elem() + + tests := map[string]struct { + u UserCommand + }{ + "UserVimCommand": { + u: UserVimCommand(""), + }, + "UserLuaCommand": { + u: UserLuaCommand{}, + }, + } + for name, tt := range tests { + tt := tt + t.Run(name, func(t *testing.T) { + t.Parallel() + + v := reflect.TypeOf(tt.u) + if !v.Implements(uc) { + t.Fatalf("%s type not implements %q interface", v.Name(), "UserCommand") + } + + tt.u.command() + }) + } +}