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

Function TestIntSetMarshalJSON

pkg/set/intset_test.go:26–42  ·  view source on GitHub ↗

IntSet.MarshalJSON() is called with series of cases for valid and erroneous inputs and the result is validated.

(t *testing.T)

Source from the content-addressed store, hash-verified

24
25// IntSet.MarshalJSON() is called with series of cases for valid and erroneous inputs and the result is validated.
26func TestIntSetMarshalJSON(t *testing.T) {
27 testCases := []struct {
28 set IntSet
29 expectedResult string
30 }{
31 // Test set with values.
32 {CreateIntSet(1, 2, 3), `[1,2,3]`},
33 // Test empty set.
34 {NewIntSet(), "[]"},
35 }
36
37 for _, testCase := range testCases {
38 if result, _ := testCase.set.MarshalJSON(); string(result) != testCase.expectedResult {
39 t.Fatalf("expected: %s, got: %s", testCase.expectedResult, string(result))
40 }
41 }
42}
43
44// IntSet.UnmarshalJSON() is called with series of cases for valid and erroneous inputs and the result is validated.
45func TestIntSetUnmarshalJSON(t *testing.T) {

Callers

nothing calls this directly

Calls 3

CreateIntSetFunction · 0.85
NewIntSetFunction · 0.85
MarshalJSONMethod · 0.45

Tested by

no test coverage detected