MCPcopy Create free account
hub / github.com/dropbox/dbxcli / TestJSONHelpRawArgsDetection

Function TestJSONHelpRawArgsDetection

cmd/help_json_test.go:622–662  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

620}
621
622func TestJSONHelpRawArgsDetection(t *testing.T) {
623 tests := []struct {
624 name string
625 args []string
626 want bool
627 }{
628 {
629 name: "root help json",
630 args: []string{"--help", "--output=json"},
631 want: true,
632 },
633 {
634 name: "command help json",
635 args: []string{"share", "list", "link", "--help", "--output=json"},
636 want: true,
637 },
638 {
639 name: "help command json",
640 args: []string{"--output=json", "help", "share", "list", "link"},
641 want: true,
642 },
643 {
644 name: "normal command json",
645 args: []string{"share", "list", "link", "--output=json"},
646 want: false,
647 },
648 {
649 name: "text help",
650 args: []string{"share", "list", "link", "--help"},
651 want: false,
652 },
653 }
654
655 for _, tt := range tests {
656 t.Run(tt.name, func(t *testing.T) {
657 if got := rawArgsRequestJSONHelp(tt.args); got != tt.want {
658 t.Fatalf("rawArgsRequestJSONHelp(%v) = %v, want %v", tt.args, got, tt.want)
659 }
660 })
661 }
662}
663
664func TestRawArgsHelpOutputFormatError(t *testing.T) {
665 tests := []struct {

Callers

nothing calls this directly

Calls 1

rawArgsRequestJSONHelpFunction · 0.85

Tested by

no test coverage detected