From 1cab9e810ef7843afdbd101ad967f835cfb64999 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 16 Jul 2015 09:49:36 +0200 Subject: file-systems: 'uuid' raises a syntax error for invalid UUIDs. * gnu/system/file-systems.scm (uuid): Call 'syntax-violation' when 'string->uuid' returns #f. * tests/file-systems.scm ("uuid, syntax error"): New test. --- tests/file-systems.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/file-systems.scm b/tests/file-systems.scm index d445b4971f..c36509b2b0 100644 --- a/tests/file-systems.scm +++ b/tests/file-systems.scm @@ -40,6 +40,16 @@ (bytevector=? (uuid "4dab5feb-d176-45de-b287-9b0a6e4c01cb") (string->uuid "4dab5feb-d176-45de-b287-9b0a6e4c01cb")))) +(test-assert "uuid, syntax error" + (catch 'syntax-error + (lambda () + (eval '(uuid "foobar") (current-module)) + #f) + (lambda (key proc message location form . args) + (and (eq? proc 'uuid) + (string-contains message "invalid UUID") + (equal? form '(uuid "foobar")))))) + (test-end) -- cgit v1.2.3 From 9cced526100ceaf303ee9c70b320a6d19f301ae6 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Sat, 18 Jul 2015 17:05:28 +0300 Subject: tests: Fix 'publish' test for nix-base32 format. This is a followup to commit 3b307162e892e0050836434b12e14376758419cc. * tests/publish.scm ("/*.narinfo"): Use 'bytevector->nix-base32-string', not 'bytevector->base32-string'. --- tests/publish.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/publish.scm b/tests/publish.scm index 60f57a8ddb..4d72fdc468 100644 --- a/tests/publish.scm +++ b/tests/publish.scm @@ -81,7 +81,7 @@ NarSize: ~d References: ~a~%" %item (basename %item) - (bytevector->base32-string + (bytevector->nix-base32-string (path-info-hash info)) (path-info-nar-size info) (basename (first (path-info-references info))))) -- cgit v1.2.3