From 68fa28b3c3f6cca4485575b6dfa418be656443e7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 4 May 2023 16:41:40 +0200 Subject: style: Make 'safe' policy less conservative. Previously, a mere (arguments '(#:tests? #f)) would lead guix style -S inputs --input-simplification=safe to bail out. It now recognizes such trivial argument lists and proceeds. * guix/scripts/style.scm (trivial-package-arguments?): New procedure. (simplify-package-inputs): Use it in the 'safe case instead of 'null?'. * tests/style.scm ("input labels, 'safe' policy, trivial arguments"): New test. --- tests/style.scm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/style.scm b/tests/style.scm index 6aab2c3785..f141a57d7f 100644 --- a/tests/style.scm +++ b/tests/style.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2021-2022 Ludovic Courtès +;;; Copyright © 2021-2023 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -234,6 +234,26 @@ (list (package-inputs (@ (my-packages) my-coreutils)) (read-package-field (@ (my-packages) my-coreutils) 'inputs))))) +(test-equal "input labels, 'safe' policy, trivial arguments" + (list `(("gmp" ,gmp) ("mpfr" ,mpfr)) + "\ + (inputs (list gmp mpfr))\n") + (call-with-test-package '((inputs `(("GMP" ,gmp) ("Mpfr" ,mpfr))) + (arguments ;"trivial" arguments + '(#:tests? #f + #:test-target "whatever"))) + (lambda (directory) + (define file + (string-append directory "/my-packages.scm")) + + (system* "guix" "style" "-L" directory "my-coreutils" + "-S" "inputs" + "--input-simplification=safe") + + (load file) + (list (package-inputs (@ (my-packages) my-coreutils)) + (read-package-field (@ (my-packages) my-coreutils) 'inputs))))) + (test-equal "input labels, 'safe' policy, nothing changed" (list `(("GMP" ,gmp) ("ACL" ,acl)) "\ -- cgit v1.2.3