MCPcopy Index your code
hub / github.com/cli/cli / Test_parseFields

Function Test_parseFields

pkg/cmd/api/fields_test.go:17–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func Test_parseFields(t *testing.T) {
18 ios, stdin, _, _ := iostreams.Test()
19 fmt.Fprint(stdin, "pasted contents")
20
21 opts := ApiOptions{
22 IO: ios,
23 RawFields: []string{
24 "robot=Hubot",
25 "destroyer=false",
26 "helper=true",
27 "location=@work",
28 },
29 MagicFields: []string{
30 "input=@-",
31 "enabled=true",
32 "victories=123",
33 },
34 }
35
36 params, err := parseFields(&opts)
37 if err != nil {
38 t.Fatalf("parseFields error: %v", err)
39 }
40
41 expect := map[string]interface{}{
42 "robot": "Hubot",
43 "destroyer": "false",
44 "helper": "true",
45 "location": "@work",
46 "input": "pasted contents",
47 "enabled": true,
48 "victories": 123,
49 }
50 assert.Equal(t, expect, params)
51}
52
53func Test_parseFields_nested(t *testing.T) {
54 ios, stdin, _, _ := iostreams.Test()

Callers

nothing calls this directly

Calls 3

TestFunction · 0.92
EqualMethod · 0.80
parseFieldsFunction · 0.70

Tested by

no test coverage detected