1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2025-06-30 19:28:39 -04:00

Don't require UIDs to be 36 characters

The spec strongly recommends this, but doesn't strictly require it
This commit is contained in:
2017-03-29 05:41:28 -04:00
parent 1d8ba5c19a
commit 5596cfbf8d
9 changed files with 15 additions and 32 deletions

View File

@ -276,21 +276,21 @@ func TestUnmarshalUID(t *testing.T) {
unmarshalHelper(t, "d1cf3d3d-9ef9-4a97-b180-81706829cb04", &u, &overwritten)
}
func TestUIDValid(t *testing.T) {
func TestUIDRecommendedFormat(t *testing.T) {
var u ofxgo.UID = "d1cf3d3d-9ef9-4a97-b180-81706829cb04"
if ok, err := u.Valid(); !ok || err != nil {
if ok, err := u.RecommendedFormat(); !ok || err != nil {
t.Fatalf("UID unexpectedly failed validation\n")
}
u = "d1cf3d3d-9ef9-4a97-b180-81706829cb0"
if ok, err := u.Valid(); ok || err == nil {
if ok, err := u.RecommendedFormat(); ok || err == nil {
t.Fatalf("UID should have failed validation because it's too short\n")
}
u = "d1cf3d3d-9ef94a97-b180-81706829cb04"
if ok, err := u.Valid(); ok || err == nil {
if ok, err := u.RecommendedFormat(); ok || err == nil {
t.Fatalf("UID should have failed validation because it's missing hyphens\n")
}
u = "d1cf3d3d-9ef9-4a97-b180981706829cb04"
if ok, err := u.Valid(); ok || err == nil {
if ok, err := u.RecommendedFormat(); ok || err == nil {
t.Fatalf("UID should have failed validation because its hyphens have been replaced\n")
}
}