MCPcopy
hub / github.com/minio/minio-go / TestStringSet_UnmarshalJSON

Function TestStringSet_UnmarshalJSON

pkg/set/stringset_test.go:352–453  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

350}
351
352func TestStringSet_UnmarshalJSON(t *testing.T) {
353 type args struct {
354 data []byte
355 expectResult []string
356 }
357 tests := []struct {
358 name string
359 set StringSet
360 args args
361 wantErr bool
362 }{
363 {
364 name: "test strings",
365 set: NewStringSet(),
366 args: args{
367 data: []byte(`["foo","bar"]`),
368 expectResult: []string{"foo", "bar"},
369 },
370 wantErr: false,
371 },
372 {
373 name: "test string",
374 set: NewStringSet(),
375 args: args{
376 data: []byte(`"foo"`),
377 expectResult: []string{"foo"},
378 },
379 wantErr: false,
380 },
381 {
382 name: "test bools",
383 set: NewStringSet(),
384 args: args{
385 data: []byte(`[false,true]`),
386 expectResult: []string{"false", "true"},
387 },
388 wantErr: false,
389 },
390 {
391 name: "test bool",
392 set: NewStringSet(),
393 args: args{
394 data: []byte(`false`),
395 expectResult: []string{"false"},
396 },
397 wantErr: false,
398 },
399 {
400 name: "test ints",
401 set: NewStringSet(),
402 args: args{
403 data: []byte(`[1,2]`),
404 expectResult: []string{"1", "2"},
405 },
406 wantErr: false,
407 },
408 {
409 name: "test int",

Callers

nothing calls this directly

Calls 3

NewStringSetFunction · 0.85
UnmarshalJSONMethod · 0.45
ToSliceMethod · 0.45

Tested by

no test coverage detected