summaryrefslogtreecommitdiff
path: root/tests/functional/string-round-trip/uuid.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-05-07 07:02:57 -0300
committerEuAndreh <eu@euandre.org>2025-05-07 07:16:33 -0300
commitd3cb41376ac0be31ed2b6649dd8d6b42674ebeaf (patch)
treedf7eeb84a91114b6624a0f0fe7c1b11fa7e5ae1f /tests/functional/string-round-trip/uuid.go
parenttests/{cli-opts,integration}.sh: Add test implementations (diff)
downloaduuid-d3cb41376ac0be31ed2b6649dd8d6b42674ebeaf.tar.gz
uuid-d3cb41376ac0be31ed2b6649dd8d6b42674ebeaf.tar.xz
Support UUIDv7, with -vN for choosing
Diffstat (limited to '')
-rw-r--r--tests/functional/string-round-trip/uuid.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/functional/string-round-trip/uuid.go b/tests/functional/string-round-trip/uuid.go
index 000d3fb..82414ea 100644
--- a/tests/functional/string-round-trip/uuid.go
+++ b/tests/functional/string-round-trip/uuid.go
@@ -45,16 +45,31 @@ func assertEq(given any, expected any) {
func MainTest() {
- testing("string is the same after round-trip", func() {
- str1 := New().String()
+ testing("v4 string is the same after round-trip", func() {
+ str1 := NewV4().String()
id, err := FromString(str1)
assertEq(err, nil)
str2 := id.String()
assertEq(str1, str2)
})
- testing("UUID is the same after round-trip", func() {
- id1 := New()
+ testing("v4 UUID is the same after round-trip", func() {
+ id1 := NewV4()
+ id2, err := FromString(id1.String())
+ assertEq(err, nil)
+ assertEq(id1, id2)
+ })
+
+ testing("v7 string is the same after round-trip", func() {
+ str1 := NewV7().String()
+ id, err := FromString(str1)
+ assertEq(err, nil)
+ str2 := id.String()
+ assertEq(str1, str2)
+ })
+
+ testing("v7 UUID is the same after round-trip", func() {
+ id1 := NewV7()
id2, err := FromString(id1.String())
assertEq(err, nil)
assertEq(id1, id2)