MCPcopy Create free account
hub / github.com/canopyclimate/golive / TestBoolUnset

Function TestBoolUnset

changeset/changeset_test.go:231–264  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

229}
230
231func TestBoolUnset(t *testing.T) {
232 cs := New[FormWithBool](&cc, url.Values{})
233 form, err := cs.Struct()
234 if err != nil {
235 t.Errorf("Expected error to be nil, got %v", err)
236 }
237 if form.Flag {
238 t.Errorf("Expected Flag to be false, got %v", true)
239 }
240
241 cs.Update(url.Values{
242 "Flag": []string{"on"},
243 }, "update")
244
245 form, err = cs.Struct()
246 if err != nil {
247 t.Errorf("Expected error to be nil, got %v", err)
248 }
249 if !form.Flag {
250 t.Errorf("Expected Flag to be true, got %v", false)
251 }
252
253 cs.Update(url.Values{
254 "_target": []string{"Flag"},
255 }, "update")
256
257 form, err = cs.Struct()
258 if err != nil {
259 t.Errorf("Expected error to be nil, got %v", err)
260 }
261 if form.Flag {
262 t.Errorf("Expected Flag to be false, got %v", true)
263 }
264}
265
266func TestBoolSet(t *testing.T) {
267 cs := New[FormWithBool](&cc, url.Values{

Callers

nothing calls this directly

Calls 2

StructMethod · 0.80
UpdateMethod · 0.80

Tested by

no test coverage detected