|
|
@@ -195,3 +195,24 @@ func TestUnmarshalJSON(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+func TestMarshalText(t *testing.T) {
|
|
|
+ u, err := ParseUUID("486f3a88-775b-11e3-ae07-d231feb1dc81")
|
|
|
+ if err != nil {
|
|
|
+ t.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ text, err := u.MarshalText()
|
|
|
+ if err != nil {
|
|
|
+ t.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ var u2 UUID
|
|
|
+ if err := u2.UnmarshalText(text); err != nil {
|
|
|
+ t.Fatal(err)
|
|
|
+ }
|
|
|
+
|
|
|
+ if u != u2 {
|
|
|
+ t.Fatalf("uuids not equal after marshalling: before=%s after=%s", u, u2)
|
|
|
+ }
|
|
|
+}
|