(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func 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 | |
| 53 | func Test_parseFields_nested(t *testing.T) { |
| 54 | ios, stdin, _, _ := iostreams.Test() |
nothing calls this directly
no test coverage detected