package cli import ( "strings" "testing" cmds "github.com/ipfs/go-ipfs/commands" "gx/ipfs/QmUyfy4QSr3NXym4etEiRyxBLqqAeKHJuRdi8AACxg63fZ/go-ipfs-cmdkit" ) func TestSynopsisGenerator(t *testing.T) { command := &cmds.Command{ Arguments: []cmdkit.Argument{ cmdkit.StringArg("required", true, false, ""), cmdkit.StringArg("variadic", false, true, ""), }, Options: []cmdkit.Option{ cmdkit.StringOption("opt", "o", "Option"), }, Helptext: cmdkit.HelpText{ SynopsisOptionsValues: map[string]string{ "opt": "OPTION", }, }, } syn := generateSynopsis(command, "cmd") t.Logf("Synopsis is: %s", syn) if !strings.HasPrefix(syn, "cmd ") { t.Fatal("Synopsis should start with command name") } if !strings.Contains(syn, "[--opt=