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

Function TestStringSetAdd

pkg/set/stringset_test.go:53–73  ·  view source on GitHub ↗

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

51
52// StringSet.Add() is called with series of cases for valid and erroneous inputs and the result is validated.
53func TestStringSetAdd(t *testing.T) {
54 testCases := []struct {
55 value string
56 expectedResult string
57 }{
58 // Test first addition.
59 {"foo", `[foo]`},
60 // Test duplicate addition.
61 {"foo", `[foo]`},
62 // Test new addition.
63 {"bar", `[bar foo]`},
64 }
65
66 ss := NewStringSet()
67 for _, testCase := range testCases {
68 ss.Add(testCase.value)
69 if str := ss.String(); str != testCase.expectedResult {
70 t.Fatalf("expected: %s, got: %s", testCase.expectedResult, str)
71 }
72 }
73}
74
75// StringSet.Remove() is called with series of cases for valid and erroneous inputs and the result is validated.
76func TestStringSetRemove(t *testing.T) {

Callers

nothing calls this directly

Calls 3

AddMethod · 0.95
StringMethod · 0.95
NewStringSetFunction · 0.85

Tested by

no test coverage detected