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

Function assetsFromArgs

internal/attachments/flags_test.go:34–47  ·  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

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

Calls 3

AddFlagFunction · 0.85
UserAssetsMethod · 0.80
HelperMethod · 0.65

Tested by

no test coverage detected