| 5 | ) |
| 6 | |
| 7 | func TestHeadersToStringConversion(t *testing.T) { |
| 8 | expectations := []struct { |
| 9 | in headersList |
| 10 | out string |
| 11 | }{ |
| 12 | { |
| 13 | []header{}, |
| 14 | "[]", |
| 15 | }, |
| 16 | { |
| 17 | []header{ |
| 18 | {"Key1", "Value1"}, |
| 19 | {"Key2", "Value2"}}, |
| 20 | "[{Key1 Value1} {Key2 Value2}]", |
| 21 | }, |
| 22 | } |
| 23 | for _, e := range expectations { |
| 24 | actual := e.in.String() |
| 25 | expected := e.out |
| 26 | if expected != actual { |
| 27 | t.Errorf("Expected \"%v\", but got \"%v\"", expected, actual) |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | func TestShouldErrorOnInvalidFormat(t *testing.T) { |
| 33 | h := new(headersList) |