MCPcopy Create free account
hub / github.com/cli/cli / assetsFromArgs

Function assetsFromArgs

internal/attachments/flags_test.go:35–48  ·  view source on GitHub ↗

Resolved through the public entry point, so a fixture is built the way a command builds one.

(t *testing.T, args ...string)

Source from the content-addressed store, hash-verified

33// Resolved through the public entry point, so a fixture is built the way a
34// command builds one.
35func assetsFromArgs(t *testing.T, args ...string) ([]UserAsset, error) {
36 t.Helper()
37
38 cmd := &cobra.Command{}
39 attachFlag := AddFlag(cmd)
40
41 argv := make([]string, 0, len(args)*2)
42 for _, arg := range args {
43 argv = append(argv, "--attach", arg)
44 }
45 require.NoError(t, cmd.Flags().Parse(argv))
46
47 return attachFlag.UserAssets()
48}
49
50func TestAddFlag(t *testing.T) {
51 tests := []struct {

Calls 3

AddFlagFunction · 0.85
UserAssetsMethod · 0.80
HelperMethod · 0.65

Tested by

no test coverage detected