(t *testing.T)
| 102 | } |
| 103 | |
| 104 | func TestNullUUIDUnmarshalText(t *testing.T) { |
| 105 | tests := []struct { |
| 106 | nullUUID NullUUID |
| 107 | }{ |
| 108 | { |
| 109 | nullUUID: NullUUID{}, |
| 110 | }, |
| 111 | { |
| 112 | nullUUID: NullUUID{ |
| 113 | UUID: MustParse("12345678-abcd-1234-abcd-0123456789ab"), |
| 114 | Valid: true, |
| 115 | }, |
| 116 | }, |
| 117 | } |
| 118 | for _, test := range tests { |
| 119 | var uText []byte |
| 120 | var uErr error |
| 121 | nuText, nuErr := test.nullUUID.MarshalText() |
| 122 | if test.nullUUID.Valid { |
| 123 | uText, uErr = test.nullUUID.UUID.MarshalText() |
| 124 | } else { |
| 125 | uText = []byte("null") |
| 126 | } |
| 127 | if nuErr != uErr { |
| 128 | t.Errorf("expected error %e, got %e", nuErr, uErr) |
| 129 | } |
| 130 | if !bytes.Equal(nuText, uText) { |
| 131 | t.Errorf("expected text data %s, got %s", string(nuText), string(uText)) |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | func TestNullUUIDMarshalBinary(t *testing.T) { |
| 137 | tests := []struct { |
nothing calls this directly
no test coverage detected