(t *testing.T)
| 98 | } |
| 99 | |
| 100 | func TestValues_Pointers(t *testing.T) { |
| 101 | str := "s" |
| 102 | strPtr := &str |
| 103 | |
| 104 | tests := []struct { |
| 105 | input interface{} |
| 106 | want url.Values |
| 107 | }{ |
| 108 | // nil pointers (zero values) |
| 109 | {struct{ V *string }{}, url.Values{"V": {""}}}, |
| 110 | {struct{ V *int }{}, url.Values{"V": {""}}}, |
| 111 | |
| 112 | // non-zero pointer values |
| 113 | {struct{ V *string }{&str}, url.Values{"V": {"s"}}}, |
| 114 | {struct{ V **string }{&strPtr}, url.Values{"V": {"s"}}}, |
| 115 | |
| 116 | // slices of pointer values |
| 117 | {struct{ V []*string }{}, url.Values{}}, |
| 118 | {struct{ V []*string }{[]*string{&str, &str}}, url.Values{"V": {"s", "s"}}}, |
| 119 | |
| 120 | // pointer to slice |
| 121 | {struct{ V *[]string }{}, url.Values{"V": {""}}}, |
| 122 | {struct{ V *[]string }{&[]string{"a", "b"}}, url.Values{"V": {"a", "b"}}}, |
| 123 | |
| 124 | // pointer values for the input struct itself |
| 125 | {(*struct{})(nil), url.Values{}}, |
| 126 | {&struct{}{}, url.Values{}}, |
| 127 | {&struct{ V string }{}, url.Values{"V": {""}}}, |
| 128 | {&struct{ V string }{"v"}, url.Values{"V": {"v"}}}, |
| 129 | } |
| 130 | |
| 131 | for _, tt := range tests { |
| 132 | testValue(t, tt.input, tt.want) |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | func TestValues_Slices(t *testing.T) { |
| 137 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…