From 6c5790a2faf8ffc401e43b13425a707394e40874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 7 May 2019 10:50:28 +0200 Subject: uuid: 'fat-uuid->string' preserves leading zeros. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . Reported by sirgazil . Previously, leading zeros would be removed, leading to an "invalid" UUID: (uuid->string (uuid "00CA-050E" 'fat32)) ⇒ "CA-50E" (string->uuid "CA-50E" 'fat32) ⇒ #f * gnu/system/uuid.scm (fat-uuid->string): Pad digits with zeros. * tests/uuid.scm ("uuid, FAT32, leading zeros preserved"): New test. --- tests/uuid.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/uuid.scm b/tests/uuid.scm index 260614f079..1c6d1e9e57 100644 --- a/tests/uuid.scm +++ b/tests/uuid.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2017, 2018 Ludovic Courtès +;;; Copyright © 2015, 2017, 2018, 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -57,6 +57,10 @@ "1234-ABCD" (uuid->string (uuid "1234-abcd" 'fat32))) +(test-equal "uuid, FAT32, leading zeros preserved" + "00CA-050E" ; + (uuid->string (uuid "00CA-050E" 'fat32))) + (test-assert "uuid, dynamic value" (let* ((good "4dab5feb-d176-45de-b287-9b0a6e4c01cb") (bad (string-drop good 3))) -- cgit v1.2.3