Humanize serialization of version vectors (again)

This commit is contained in:
Jakob Borg
2016-01-20 11:10:22 -08:00
parent e267bf3e09
commit 11d4986517
9 changed files with 38 additions and 17 deletions

View File

@@ -74,3 +74,17 @@ func TestMarshallingDeviceID(t *testing.T) {
t.Error("Compare error")
}
}
func TestShortIDString(t *testing.T) {
id, _ := DeviceIDFromString(formatted)
sid := id.Short().String()
if len(sid) != 7 {
t.Errorf("Wrong length for short ID: got %d, want 7", len(sid))
}
want := formatted[:len(sid)]
if sid != want {
t.Errorf("Wrong short ID: got %q, want %q", sid, want)
}
}