diff --git a/command_test.go b/command_test.go new file mode 100644 index 0000000..c7f968a --- /dev/null +++ b/command_test.go @@ -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) +}