(t *testing.T)
| 70 | } |
| 71 | |
| 72 | func TestNullUUIDMarshalText(t *testing.T) { |
| 73 | tests := []struct { |
| 74 | nullUUID NullUUID |
| 75 | }{ |
| 76 | { |
| 77 | nullUUID: NullUUID{}, |
| 78 | }, |
| 79 | { |
| 80 | nullUUID: NullUUID{ |
| 81 | UUID: MustParse("12345678-abcd-1234-abcd-0123456789ab"), |
| 82 | Valid: true, |
| 83 | }, |
| 84 | }, |
| 85 | } |
| 86 | for _, test := range tests { |
| 87 | var uText []byte |
| 88 | var uErr error |
| 89 | nuText, nuErr := test.nullUUID.MarshalText() |
| 90 | if test.nullUUID.Valid { |
| 91 | uText, uErr = test.nullUUID.UUID.MarshalText() |
| 92 | } else { |
| 93 | uText = []byte("null") |
| 94 | } |
| 95 | if nuErr != uErr { |
| 96 | t.Errorf("expected error %e, got %e", nuErr, uErr) |
| 97 | } |
| 98 | if !bytes.Equal(nuText, uText) { |
| 99 | t.Errorf("expected text data %s, got %s", string(nuText), string(uText)) |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | func TestNullUUIDUnmarshalText(t *testing.T) { |
| 105 | tests := []struct { |
nothing calls this directly
no test coverage detected