From 2c5fb13a0504df593b64c416d952df90fb4a5f3f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 22 Nov 2023 16:32:33 +0100 Subject: read-print: Properly indent ‘parameterize’. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . * guix/read-print.scm (%special-forms): Add ‘parameterize’. * tests/read-print.scm: Add test. Reported-by: Maxime Devos Change-Id: I922bffc527ade539cf2eb304acb25bc9c705a459 --- tests/read-print.scm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/read-print.scm b/tests/read-print.scm index c8b8eb73fe..c1006a8a68 100644 --- a/tests/read-print.scm +++ b/tests/read-print.scm @@ -173,6 +173,11 @@ expressions." 'odd) (else #f))") +(test-pretty-print "\ +(parameterize ((a 1) + (b 2)) + (call f g h))") + (test-pretty-print "\ #~(string-append #$coreutils \"/bin/uname\")") -- cgit v1.2.3 From e04f8fe4ea50f81847cad98a5dc6b32c27b81ea2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 23 Nov 2023 15:22:06 +0100 Subject: tests: Use ‘test-equal’ for ‘terminal-string-width’ tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * tests/syscalls.scm ("terminal-string-width English") ("terminal-string-width Japanese"): Use ‘test-equal’. Change-Id: I3791b2e4c9e35735db6c6da995da8ef0f9a71804 --- tests/syscalls.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/syscalls.scm b/tests/syscalls.scm index eb85b358c4..340c1147de 100644 --- a/tests/syscalls.scm +++ b/tests/syscalls.scm @@ -583,11 +583,13 @@ (test-assert "terminal-rows" (> (terminal-rows) 0)) -(test-assert "terminal-string-width English" - (= (terminal-string-width "hello") 5)) +(test-equal "terminal-string-width English" + 5 + (terminal-string-width "hello")) -(test-assert "terminal-string-width Japanese" - (= (terminal-string-width "今日は") 6)) +(test-equal "terminal-string-width Japanese" + 6 + (terminal-string-width "今日は")) (test-assert "openpty" (let ((head inferior (openpty))) -- cgit v1.2.3 From 9b48cf8cdd5718bc35828b3c4c9abe84122dad96 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 23 Nov 2023 15:22:42 +0100 Subject: tests: Import (guix build syscalls) when (guix build store-copy) is used. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes a test failure introduced in 189525412e3d803f3f77e15ec4a62aaa57f65a2d. * guix/progress.scm: Autoload (guix build syscalls). * tests/gexp.scm ("gexp->derivation, store copy"): Add (guix build syscalls) to the list of imported modules. Use ‘with-imported-modules’ rather than #:modules. Change-Id: I8d3fe90f564ef4b1a340f34cee6c08a741f7b836 --- guix/progress.scm | 3 +-- tests/gexp.scm | 59 ++++++++++++++++++++++++++++--------------------------- 2 files changed, 31 insertions(+), 31 deletions(-) (limited to 'tests') diff --git a/guix/progress.scm b/guix/progress.scm index 13d3ddc171..e1b35094e1 100644 --- a/guix/progress.scm +++ b/guix/progress.scm @@ -21,8 +21,7 @@ (define-module (guix progress) #:use-module (guix records) - #:use-module ((guix build syscalls) - #:select (terminal-string-width)) + #:autoload (guix build syscalls) (terminal-string-width) #:use-module (srfi srfi-19) #:use-module (rnrs io ports) #:use-module (rnrs bytevectors) diff --git a/tests/gexp.scm b/tests/gexp.scm index 7a90f8dcbf..0e3c446576 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014-2022 Ludovic Courtès +;;; Copyright © 2014-2023 Ludovic Courtès ;;; Copyright © 2021-2022 Maxime Devos ;;; ;;; This file is part of GNU Guix. @@ -826,38 +826,39 @@ (call-with-output-file (string-append #$output "/two") (lambda (port) (display "This is the second one." port)))))) - (build-drv #~(begin - (use-modules (guix build store-copy) - (guix build utils) - (srfi srfi-1)) - - (define (canonical-file? file) - ;; Copied from (guix tests). - (let ((st (lstat file))) - (or (not (string-prefix? (%store-directory) file)) - (eq? 'symlink (stat:type st)) - (and (= 1 (stat:mtime st)) - (zero? (logand #o222 (stat:mode st))))))) - - (mkdir #$output) - (populate-store '("graph") #$output - #:deduplicate? #f) - - ;; Check whether 'populate-store' canonicalizes - ;; permissions and timestamps. - (unless (every canonical-file? (find-files #$output)) - (error "not canonical!" #$output))))) + (build-drv + (with-imported-modules '((guix build store-copy) + (guix build syscalls) + (guix progress) + (guix records) + (guix sets) + (guix build utils)) + #~(begin + (use-modules (guix build store-copy) + (guix build utils) + (srfi srfi-1)) + + (define (canonical-file? file) + ;; Copied from (guix tests). + (let ((st (lstat file))) + (or (not (string-prefix? (%store-directory) file)) + (eq? 'symlink (stat:type st)) + (and (= 1 (stat:mtime st)) + (zero? (logand #o222 (stat:mode st))))))) + + (mkdir #$output) + (populate-store '("graph") #$output + #:deduplicate? #f) + + ;; Check whether 'populate-store' canonicalizes + ;; permissions and timestamps. + (unless (every canonical-file? (find-files #$output)) + (error "not canonical!" #$output)))))) (mlet* %store-monad ((one (gexp->derivation "one" build-one)) (two (gexp->derivation "two" (build-two one))) (drv (gexp->derivation "store-copy" build-drv #:references-graphs - `(("graph" ,two)) - #:modules - '((guix build store-copy) - (guix progress) - (guix records) - (guix sets) - (guix build utils)))) + `(("graph" ,two)))) (ok? (built-derivations (list drv))) (out -> (derivation->output-path drv))) (let ((one (derivation->output-path one)) -- cgit v1.2.3