From 932d1600564cbf359a6ccd1086b968a934bef8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 27 Oct 2018 15:45:45 +0200 Subject: gexp: 'gexp-modules' now consistently deletes duplicates. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . Reported by Clément Lassieur . * guix/gexp.scm (gexp-attribute): Add 'equal?' optional parameter; pass it to 'delete-duplicates'. (gexp-modules)[module=?]: New procedure. Pass it to 'gexp-attribute'. * tests/gexp.scm ("gexp-modules deletes duplicates"): New test. --- tests/gexp.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') diff --git a/tests/gexp.scm b/tests/gexp.scm index 813ea2ff6f..467370f8cb 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -680,6 +680,22 @@ #~(foo #$@(list (with-imported-modules '((foo)) #~+) (with-imported-modules '((bar)) #~-))))) +(test-assert "gexp-modules deletes duplicates" ; + (let ((make-file (lambda () + ;; Use 'eval' to make sure we get an object that's not + ;; 'eq?' nor 'equal?' due to the closures it embeds. + (eval '(scheme-file "bar.scm" #~(define-module (bar))) + (current-module))))) + (define result + ((@@ (guix gexp) gexp-modules) + (with-imported-modules `(((bar) => ,(make-file)) + ((bar) => ,(make-file)) + (foo) (foo)) + #~+))) + + (match result + (((('bar) '=> (? scheme-file?)) ('foo)) #t)))) + (test-equal "gexp-modules and literal Scheme object" '() (gexp-modules #t)) -- cgit v1.2.3