MCPcopy
hub / github.com/google/uuid / TestNullUUIDValue

Function TestNullUUIDValue

null_test.go:41–70  ·  null_test.go::TestNullUUIDValue
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestNullUUIDValue(t *testing.T) {
42 var u UUID
43 var nu NullUUID
44
45 nuValue, nuErr := nu.Value()
46 if nuErr != nil {
47 t.Errorf("expected nil err, got err %s", nuErr)
48 }
49 if nuValue != nil {
50 t.Errorf("expected nil value, got non-nil %s", nuValue)
51 }
52
53 u = MustParse("12345678-abcd-1234-abcd-0123456789ab")
54 nu = NullUUID{
55 UUID: MustParse("12345678-abcd-1234-abcd-0123456789ab"),
56 Valid: true,
57 }
58
59 uValue, uErr := u.Value()
60 nuValue, nuErr = nu.Value()
61 if uErr != nil {
62 t.Errorf("expected nil err, got err %s", uErr)
63 }
64 if nuErr != nil {
65 t.Errorf("expected nil err, got err %s", nuErr)
66 }
67 if uValue != nuValue {
68 t.Errorf("expected uuid %s and nulluuid %s to be equal ", uValue, nuValue)
69 }
70}
71
72func TestNullUUIDMarshalText(t *testing.T) {
73 tests := []struct {

Callers

nothing calls this directly

Calls 3

ValueMethod · 0.95
ValueMethod · 0.95
MustParseFunction · 0.85

Tested by

no test coverage detected