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

Function TestStringSetString

pkg/set/stringset_test.go:308–326  ·  view source on GitHub ↗

StringSet.String() 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

306
307// StringSet.String() is called with series of cases for valid and erroneous inputs and the result is validated.
308func TestStringSetString(t *testing.T) {
309 testCases := []struct {
310 set StringSet
311 expectedResult string
312 }{
313 // Test empty set.
314 {NewStringSet(), `[]`},
315 // Test set with empty value.
316 {CreateStringSet(""), `[]`},
317 // Test set with value.
318 {CreateStringSet("foo"), `[foo]`},
319 }
320
321 for _, testCase := range testCases {
322 if str := testCase.set.String(); str != testCase.expectedResult {
323 t.Fatalf("expected: %s, got: %s", testCase.expectedResult, str)
324 }
325 }
326}
327
328// StringSet.ToSlice() is called with series of cases for valid and erroneous inputs and the result is validated.
329func TestStringSetToSlice(t *testing.T) {

Callers

nothing calls this directly

Calls 3

NewStringSetFunction · 0.85
CreateStringSetFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected