From 9b48fb88ca8177c987b0d3bf2e9ae46dac782430 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 4 Nov 2012 01:29:18 +0100 Subject: 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. --- tests/utils.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') 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 @@ (define %nix-hash (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 make-foo -- cgit v1.2.3