summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-02-12 22:17:11 +0100
committerLudovic Courtès <ludo@gnu.org>2019-02-12 23:30:16 +0100
commit739380542da7e434c581ec620edeb4348d6ece89 (patch)
tree85d7c3d1caf3ead51829016fb3787116cfbab588 /tests
parent46765f82dbd541a6ab48ba84816dbcf701d8714b (diff)
downloadguix-739380542da7e434c581ec620edeb4348d6ece89.tar.gz
inferior: Add 'inferior-available-packages'.
* guix/inferior.scm (inferior-available-packages): New procedure.
* tests/inferior.scm ("inferior-available-packages"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/inferior.scm22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/inferior.scm b/tests/inferior.scm
index d5a894ca8f..71ebf8f59b 100644
--- a/tests/inferior.scm
+++ b/tests/inferior.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -89,6 +89,26 @@
            (close-inferior inferior)
            result))))
 
+(test-equal "inferior-available-packages"
+  (take (sort (fold-available-packages
+               (lambda* (name version result
+                              #:key supported? deprecated?
+                              #:allow-other-keys)
+                 (if (and supported? (not deprecated?))
+                     (alist-cons name version result)
+                     result))
+               '())
+              (lambda (x y)
+                (string<? (car x) (car y))))
+        10)
+  (let* ((inferior (open-inferior %top-builddir
+                                  #:command "scripts/guix"))
+         (packages (inferior-available-packages inferior)))
+    (close-inferior inferior)
+    (take (sort packages (lambda (x y)
+                           (string<? (car x) (car y))))
+          10)))
+
 (test-equal "lookup-inferior-packages"
   (let ((->list (lambda (package)
                   (list (package-name package)