summary refs log tree commit diff
path: root/tests/file-systems.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2019-09-25 22:43:41 +0900
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-05-20 08:30:34 -0400
commitfa35fb58c84d1c1741e4e63c0b37074e35ed2a61 (patch)
tree284c62546914c65213196ef31d03c890901b95b0 /tests/file-systems.scm
parent281d80d8e547fe663aaacb3226119166dd3100f9 (diff)
downloadguix-fa35fb58c84d1c1741e4e63c0b37074e35ed2a61.tar.gz
file-systems: Add helpers for parsing the options string into an alist.
* gnu/system/file-systems.scm (file-system-options->alist)
(alist->file-system-options): New procedures.
* tests/file-systems.scm: New tests.
* doc/guix.texi (File Systems): Add note about the newly added procedures.
Diffstat (limited to 'tests/file-systems.scm')
-rw-r--r--tests/file-systems.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/file-systems.scm b/tests/file-systems.scm
index 4c28d0ebc5..41f1021067 100644
--- a/tests/file-systems.scm
+++ b/tests/file-systems.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -64,4 +65,22 @@
           (_ #f))
         (source-module-closure '((gnu system file-systems)))))
 
+(test-equal "file-system-options->alist"
+  '("autodefrag" ("subvol" . "home") ("compress" . "lzo"))
+  (file-system-options->alist "autodefrag,subvol=home,compress=lzo"))
+
+(test-equal "file-system-options->alist (#f)"
+  '()
+  (file-system-options->alist #f))
+
+(test-equal "alist->file-system-options"
+  "autodefrag,subvol=root,compress=lzo"
+  (alist->file-system-options '("autodefrag"
+                                ("subvol" . "root")
+                                ("compress" . "lzo"))))
+
+(test-equal "alist->file-system-options (null)"
+  #f
+  (alist->file-system-options '()))
+
 (test-end)