Skip to content

Commit

Permalink
nvim: add UserCommand testcase
Browse files Browse the repository at this point in the history
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
  • Loading branch information
zchee committed Jan 18, 2022
1 parent 01a928e commit 37f6413
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions nvim/types_test.go
@@ -1,6 +1,7 @@
package nvim

import (
"reflect"
"testing"
)

Expand Down Expand Up @@ -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()
})
}
}

0 comments on commit 37f6413

Please sign in to comment.