(t *testing.T)
| 2281 | } |
| 2282 | |
| 2283 | func TestByteSorted_NilHandling(t *testing.T) { |
| 2284 | var nilSet ByteSorted |
| 2285 | |
| 2286 | // Test nil encoding |
| 2287 | var buf bytes.Buffer |
| 2288 | writer := msgp.NewWriter(&buf) |
| 2289 | err := nilSet.EncodeMsg(writer) |
| 2290 | if err != nil { |
| 2291 | t.Fatalf("EncodeMsg failed for nil: %v", err) |
| 2292 | } |
| 2293 | writer.Flush() |
| 2294 | |
| 2295 | // Test nil decoding |
| 2296 | reader := msgp.NewReader(&buf) |
| 2297 | var decoded ByteSorted |
| 2298 | err = decoded.DecodeMsg(reader) |
| 2299 | if err != nil { |
| 2300 | t.Fatalf("DecodeMsg failed for nil: %v", err) |
| 2301 | } |
| 2302 | |
| 2303 | if decoded != nil { |
| 2304 | t.Fatal("expected nil, got non-nil") |
| 2305 | } |
| 2306 | |
| 2307 | // Test nil marshaling |
| 2308 | data, err := nilSet.MarshalMsg(nil) |
| 2309 | if err != nil { |
| 2310 | t.Fatalf("MarshalMsg failed for nil: %v", err) |
| 2311 | } |
| 2312 | |
| 2313 | // Test nil unmarshaling |
| 2314 | var unmarshaled ByteSorted |
| 2315 | _, err = unmarshaled.UnmarshalMsg(data) |
| 2316 | if err != nil { |
| 2317 | t.Fatalf("UnmarshalMsg failed for nil: %v", err) |
| 2318 | } |
| 2319 | |
| 2320 | if unmarshaled != nil { |
| 2321 | t.Fatal("expected nil, got non-nil") |
| 2322 | } |
| 2323 | |
| 2324 | // Test AsSlice on nil |
| 2325 | slice := nilSet.AsSlice() |
| 2326 | if slice != nil { |
| 2327 | t.Fatal("expected nil slice, got non-nil") |
| 2328 | } |
| 2329 | |
| 2330 | // Test FromSlice with nil |
| 2331 | fromNilSlice := ByteSortedFromSlice(nil) |
| 2332 | if fromNilSlice != nil { |
| 2333 | t.Fatal("expected nil from nil slice, got non-nil") |
| 2334 | } |
| 2335 | } |
| 2336 | |
| 2337 | func TestByteSorted_EmptySet(t *testing.T) { |
| 2338 | set := make(ByteSorted) |
nothing calls this directly
no test coverage detected
searching dependent graphs…