package ids import "testing" func TestNewStableIDIsOpaque128BitHex(t *testing.T) { id, err := NewStableID() if err != nil || len(id) != 32 { t.Fatalf("NewStableID() = %q, %v", id, err) } if !(SemanticRef{OwnerNamespace: "world", SemanticKind: "object", StableID: id}.Valid()) { t.Fatal("stable id was not accepted by semantic reference") } } func TestSemanticRefRejectsInvalidRevision(t *testing.T) { revision := Revision(0) ref := SemanticRef{OwnerNamespace: "world", SemanticKind: "object", StableID: "id", Revision: &revision} if ref.Valid() { t.Fatal("semantic reference accepted invalid revision") } }