From e8ab4ccaa7def9838a7fc240609028078a0988b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 3 Jun 2024 22:26:28 +0200 Subject: [PATCH] =?UTF-8?q?style:=20Fix=20conversion=20of=20=E2=80=98unquo?= =?UTF-8?q?te-splicing=E2=80=99=20by=20=E2=80=98-S=20arguments=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/scripts/style.scm (unquote->ungexp): Add missing comma for ‘ungexp-splicing’. * tests/style.scm ("gexpify arguments, substitute-keyword-arguments + unquote-splicing"): New test. Change-Id: I17dcdd9b4812d54ddba1137e369360706b137bb4 --- guix/scripts/style.scm | 4 ++-- tests/style.scm | 25 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm index 211980dc1c..0727ac1480 100644 --- a/guix/scripts/style.scm +++ b/guix/scripts/style.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2021-2023 Ludovic Courtès +;;; Copyright © 2021-2024 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -304,7 +304,7 @@ (define (unquote->ungexp value) value)) (('unquote-splicing x) (if (= quotation 1) - `(ungexp-splicing x) + `(ungexp-splicing ,x) value)) (('quasiquote x) (list 'quasiquote (loop x (+ quotation 1)))) diff --git a/tests/style.scm b/tests/style.scm index 5e38549606..3125f4cb1b 100644 --- a/tests/style.scm +++ b/tests/style.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2021-2023 Ludovic Courtès +;;; Copyright © 2021-2024 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -500,6 +500,29 @@ (define file (load file) (read-package-field (@ (my-packages) my-coreutils) 'arguments 7)))) +(test-equal "gexpify arguments, substitute-keyword-arguments + unquote-splicing" + "\ + (substitute-keyword-arguments (package-arguments coreutils) + ((#:make-flags flags + #~'()) + #~(cons \"-DXYZ=yes\" + #$@(if #t flags + '())))))\n" + (call-with-test-package '((arguments + (substitute-keyword-arguments + (package-arguments coreutils) + ((#:make-flags flags ''()) + `(cons "-DXYZ=yes" ,@(if #t flags '())))))) + (lambda (directory) + (define file + (string-append directory "/my-packages.scm")) + + (system* "guix" "style" "-L" directory "my-coreutils" + "-S" "arguments") + + (load file) + (read-package-field (@ (my-packages) my-coreutils) 'arguments 6)))) + (test-equal "gexpify arguments, append substitute-keyword-arguments" "\ (append (list #:tests? #f)