(t *testing.T)
| 108 | } |
| 109 | |
| 110 | func TestString_NilHandling(t *testing.T) { |
| 111 | var nilSet String |
| 112 | |
| 113 | // Test nil encoding |
| 114 | var buf bytes.Buffer |
| 115 | writer := msgp.NewWriter(&buf) |
| 116 | err := nilSet.EncodeMsg(writer) |
| 117 | if err != nil { |
| 118 | t.Fatalf("EncodeMsg failed for nil: %v", err) |
| 119 | } |
| 120 | writer.Flush() |
| 121 | |
| 122 | // Test nil decoding |
| 123 | reader := msgp.NewReader(&buf) |
| 124 | var decoded String |
| 125 | err = decoded.DecodeMsg(reader) |
| 126 | if err != nil { |
| 127 | t.Fatalf("DecodeMsg failed for nil: %v", err) |
| 128 | } |
| 129 | |
| 130 | if decoded != nil { |
| 131 | t.Fatal("expected nil, got non-nil") |
| 132 | } |
| 133 | |
| 134 | // Test nil marshaling |
| 135 | data, err := nilSet.MarshalMsg(nil) |
| 136 | if err != nil { |
| 137 | t.Fatalf("MarshalMsg failed for nil: %v", err) |
| 138 | } |
| 139 | |
| 140 | // Test nil unmarshaling |
| 141 | var unmarshaled String |
| 142 | _, err = unmarshaled.UnmarshalMsg(data) |
| 143 | if err != nil { |
| 144 | t.Fatalf("UnmarshalMsg failed for nil: %v", err) |
| 145 | } |
| 146 | |
| 147 | if unmarshaled != nil { |
| 148 | t.Fatal("expected nil, got non-nil") |
| 149 | } |
| 150 | |
| 151 | // Test AsSlice on nil |
| 152 | slice := nilSet.AsSlice() |
| 153 | if slice != nil { |
| 154 | t.Fatal("expected nil slice, got non-nil") |
| 155 | } |
| 156 | |
| 157 | // Test FromSlice with nil |
| 158 | fromNilSlice := StringFromSlice(nil) |
| 159 | if fromNilSlice != nil { |
| 160 | t.Fatal("expected nil from nil slice, got non-nil") |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | func TestString_EmptySet(t *testing.T) { |
| 165 | set := make(String) |
nothing calls this directly
no test coverage detected
searching dependent graphs…