(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestQuery(t *testing.T) { |
| 119 | for _, item := range []struct { |
| 120 | query string |
| 121 | name string |
| 122 | expected string |
| 123 | }{ |
| 124 | {"foo=bar", "foo", "bar"}, |
| 125 | {"foo=bar&baz=123", "foo", "bar"}, |
| 126 | {"foo=bar&baz=123", "baz", "123"}, |
| 127 | {"foo=bar&baz=123", "missing", ""}, |
| 128 | {"foo=bar&baz=123&bool&another", "bool", "true"}, |
| 129 | } { |
| 130 | t.Run(item.query+"/"+item.name, func(t *testing.T) { |
| 131 | assert.Equal(t, item.expected, Get(item.query, item.name)) |
| 132 | }) |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | var Result string |
| 137 |