(t *testing.T)
| 768 | } |
| 769 | |
| 770 | func TestInt_NilHandling(t *testing.T) { |
| 771 | var nilSet Int |
| 772 | |
| 773 | // Test nil encoding |
| 774 | var buf bytes.Buffer |
| 775 | writer := msgp.NewWriter(&buf) |
| 776 | err := nilSet.EncodeMsg(writer) |
| 777 | if err != nil { |
| 778 | t.Fatalf("EncodeMsg failed for nil: %v", err) |
| 779 | } |
| 780 | writer.Flush() |
| 781 | |
| 782 | // Test nil decoding |
| 783 | reader := msgp.NewReader(&buf) |
| 784 | var decoded Int |
| 785 | err = decoded.DecodeMsg(reader) |
| 786 | if err != nil { |
| 787 | t.Fatalf("DecodeMsg failed for nil: %v", err) |
| 788 | } |
| 789 | |
| 790 | if decoded != nil { |
| 791 | t.Fatal("expected nil, got non-nil") |
| 792 | } |
| 793 | |
| 794 | // Test nil marshaling |
| 795 | data, err := nilSet.MarshalMsg(nil) |
| 796 | if err != nil { |
| 797 | t.Fatalf("MarshalMsg failed for nil: %v", err) |
| 798 | } |
| 799 | |
| 800 | // Test nil unmarshaling |
| 801 | var unmarshaled Int |
| 802 | _, err = unmarshaled.UnmarshalMsg(data) |
| 803 | if err != nil { |
| 804 | t.Fatalf("UnmarshalMsg failed for nil: %v", err) |
| 805 | } |
| 806 | |
| 807 | if unmarshaled != nil { |
| 808 | t.Fatal("expected nil, got non-nil") |
| 809 | } |
| 810 | |
| 811 | // Test AsSlice on nil |
| 812 | slice := nilSet.AsSlice() |
| 813 | if slice != nil { |
| 814 | t.Fatal("expected nil slice, got non-nil") |
| 815 | } |
| 816 | |
| 817 | // Test FromSlice with nil |
| 818 | fromNilSlice := IntFromSlice(nil) |
| 819 | if fromNilSlice != nil { |
| 820 | t.Fatal("expected nil from nil slice, got non-nil") |
| 821 | } |
| 822 | } |
| 823 | |
| 824 | func TestInt_EmptySet(t *testing.T) { |
| 825 | set := make(Int) |
nothing calls this directly
no test coverage detected
searching dependent graphs…