aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-07-16 09:49:36 +0200
committerLudovic Courtès <ludo@gnu.org>2015-07-16 09:49:36 +0200
commit1cab9e810ef7843afdbd101ad967f835cfb64999 (patch)
treea72b0bf84ca491834a94b92ad3ce93cd9b9de879 /tests
parent68e88a09b46cc2b4affebbd258decbcd4024f0db (diff)
downloadguix-1cab9e810ef7843afdbd101ad967f835cfb64999.tar
guix-1cab9e810ef7843afdbd101ad967f835cfb64999.tar.gz
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/file-systems.scm10
1 files changed, 10 insertions, 0 deletions
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)