go_sysutils/exec_extra/funcs_test.go
2024-06-17 04:33:30 -04:00

28 lines
483 B
Go

package exec_extra
import (
`testing`
)
type (
testStruct struct {
Foo string `cmdarg:"short=f,long=foo"`
Bar int `cmdarg:"short=b,long=bar,prefer_short"`
}
)
func TestGetCmdFromStruct(t *testing.T) {
var err error
var out []string
var v *testStruct = &testStruct{
Foo: "foo",
Bar: 123,
}
if out, err = GetCmdFromStruct(v); err != nil {
t.Fatalf("Received error getting command from struct: %v", err)
}
t.Logf("Got command args from struct:\n%#v", out)
}