summaryrefslogtreecommitdiff
path: root/tests/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-11-04 01:29:18 +0100
committerLudovic Courtès <ludo@gnu.org>2012-11-04 01:29:18 +0100
commit9b48fb88ca8177c987b0d3bf2e9ae46dac782430 (patch)
tree03cc3b7428339c1b9ba250dba3dd1aa6365f0d34 /tests/utils.scm
parentd388c2c435395aee61dc074023b1f218e6037545 (diff)
utils: Add `package-name->name+version'.
* guix/utils.scm (package-name->name+version): New procedure. * guix-package.in (guix-package)[find-package]: Use it. * tests/utils.scm ("package-name->name+version"): New test.
Diffstat (limited to 'tests/utils.scm')
-rw-r--r--tests/utils.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/utils.scm b/tests/utils.scm
index 7dd248fae2..1ced410d41 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -104,6 +104,24 @@
(equal? nix (gnu-triplet->nix-system gnu)))
gnu nix))))
+(test-assert "package-name->name+version"
+ (every (match-lambda
+ ((name version)
+ (let*-values (((full-name)
+ (if version
+ (string-append name "-" version)
+ name))
+ ((name* version*)
+ (package-name->name+version full-name)))
+ (and (equal? name* name)
+ (equal? version* version)))))
+ '(("foo" "0.9.1b")
+ ("foo-bar" "1.0")
+ ("foo-bar2" #f)
+ ("guile" "2.0.6.65-134c9") ; as produced by `git-version-gen'
+ ("nixpkgs" "1.0pre22125_a28fe19")
+ ("gtk2" "2.38.0"))))
+
(test-assert "define-record-type*"
(begin
(define-record-type* <foo> foo make-foo