summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-11-01 16:57:48 +0100
committerLudovic Courtès <ludo@gnu.org>2013-11-01 23:21:00 +0100
commit2876b9892583bc1245d77fd10286025cd8433ede (patch)
tree38cc9dc2cbb116c0ef3c3e742bb1d432b0bef0e4 /tests
parentcc4ecc2d8869081483feaf47bdcb4a740c7c67f8 (diff)
downloadguix-2876b9892583bc1245d77fd10286025cd8433ede.tar.gz
ui: Factorize package specification parsing.
* guix/ui.scm (package-specification->name+version+output): New
  procedure.
* guix/scripts/package.scm (specification->package+output): Use it.
* tests/ui.scm ("package-specification->name+version+output"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/ui.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui.scm b/tests/ui.scm
index 3d5c3e7969..08ee3967a8 100644
--- a/tests/ui.scm
+++ b/tests/ui.scm
@@ -65,6 +65,23 @@ interface, and powerful string processing.")
                    10)
    #\newline))
 
+(test-equal "package-specification->name+version+output"
+  '(("guile" #f "out")
+    ("guile" "2.0.9" "out")
+    ("guile" #f "debug")
+    ("guile" "2.0.9" "debug")
+    ("guile-cairo" "1.4.1" "out"))
+  (map (lambda (spec)
+         (call-with-values
+             (lambda ()
+               (package-specification->name+version+output spec))
+           list))
+       '("guile"
+         "guile-2.0.9"
+         "guile:debug"
+         "guile-2.0.9:debug"
+         "guile-cairo-1.4.1")))
+
 (test-equal "integer"
   '(1)
   (string->generations "1"))