xml
(t *testing.T)
| 156 | |
| 157 | // xml |
| 158 | func TestBinder_Bind_xml_error(t *testing.T) { |
| 159 | |
| 160 | binder := newBinder() |
| 161 | |
| 162 | if binder == nil { |
| 163 | t.Error("binder can not be nil!") |
| 164 | } |
| 165 | |
| 166 | // init DotServer |
| 167 | app := New() |
| 168 | |
| 169 | if app == nil { |
| 170 | t.Error("app can not be nil!") |
| 171 | } |
| 172 | |
| 173 | // expected |
| 174 | expected := &Person{ |
| 175 | Hair: "Brown", |
| 176 | HasGlass: true, |
| 177 | Age: 10, |
| 178 | Legs: []string{"Left", "Right"}, |
| 179 | } |
| 180 | param := &InitContextParam{ |
| 181 | t, |
| 182 | expected, |
| 183 | "application/json", |
| 184 | test.ToXML, |
| 185 | } |
| 186 | |
| 187 | // init param |
| 188 | context := initContext(param) |
| 189 | // actual |
| 190 | person := &Person{} |
| 191 | |
| 192 | err := binder.Bind(person, context) |
| 193 | |
| 194 | // check error must not nil |
| 195 | test.NotNil(t, err) |
| 196 | } |
| 197 | |
| 198 | // else |
| 199 | func TestBinder_Bind_default(t *testing.T) { |