From 1cab9e810ef7843afdbd101ad967f835cfb64999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= 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/file-systems.scm') 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