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

Function assetsFromArgs

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

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

Calls 3

AddFlagFunction · 0.85
UserAssetsMethod · 0.80
HelperMethod · 0.65

Tested by

no test coverage detected