mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-05-02 22:17:09 +08:00
add command test
This commit is contained in:
parent
e2a5f1fe99
commit
d84fc56fad
25
command_test.go
Normal file
25
command_test.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func TestGetFn(t *testing.T) {
|
||||||
|
|
||||||
|
c := newCommand()
|
||||||
|
|
||||||
|
c.define("sample", func() {})
|
||||||
|
|
||||||
|
f, err := c.getFn("sample")
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.NotNil(t, f)
|
||||||
|
|
||||||
|
f, err = c.getFn("x")
|
||||||
|
assert.Error(t, err)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user