From b1916e9a8ac8fa1bdd045d6e1d89e0f16ef7e441 Mon Sep 17 00:00:00 2001 From: "Artyom V. Poptsov" Date: Mon, 29 Apr 2024 11:27:02 +0300 Subject: [PATCH] unit-tests/logging.logger: Fix tests with Guile 2 When tests are run with Guile 2 "logging.logger.scm" would always fail due to undefined reference to "mkstemp" that was introduced only in Guile 3. In Guile 2 the procedure is called "mkstemp!". Also "call-with-port" procedure is available only from (rnrs io ports) in Guile 2, while in Guile 3 this procedure is available out of box. This patch fixes these issues by adding an additional runtime check. * unit-tests/logging.logger.scm (call-with-temporary-file): Bugfix: Check Guile major version and use "mkstemp!" when Guile 2 is used; use "mkstemp" otherwise. Also for Guile 2 load "call-with-port" from (rnrs io ports). --- unit-tests/logging.logger.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/unit-tests/logging.logger.scm b/unit-tests/logging.logger.scm index c69a86d..fbf4ce7 100644 --- a/unit-tests/logging.logger.scm +++ b/unit-tests/logging.logger.scm @@ -3,6 +3,7 @@ ;;; Copyright (C) 2003 Richard Todd ;;; Copyright (C) 2024 Maxim Cournoyer ;;; Copyright (C) 2024 David Pirotte +;;; Copyright (C) 2024 Artyom V. Poptsov ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by @@ -28,8 +29,12 @@ (define* (call-with-temporary-file proc #:key (mode "w+")) "Open a temporary file name and pass it to PROC, a procedure of one argument. The port is automatically closed." - (let ((port (mkstemp "/tmp/file-XXXXXX" mode))) - (call-with-port port proc))) + (let ((file-name "/tmp/file-XXXXXX")) + (if (< (string->number (major-version)) 3) + (let ((port (mkstemp! (string-copy file-name) mode))) + ((@ (rnrs io ports) call-with-port) port proc)) + (let ((port (mkstemp file-name mode))) + (call-with-port port proc))))) (define-class ()) base-commit: 0e2b6b0ae5cc43c98075386bb4c69defb705f3b3 -- 2.41.0 nt'>
AgeCommit message (Expand)Author
2023-06-04tests: records: Add test for ellipsis in body....* tests/records.scm ("match-record, ellipsis in body"): New test. Josselin Poiret
2023-06-04records: Add MATCH-RECORD-LAMBDA....* guix/records.scm (match-record-lambda): New syntax. * tests/records.scm ("match-record-lambda"): New test. Signed-off-by: Josselin Poiret <dev@jpoiret.xyz> (unmatched-parenthesis ew syntax
2023-06-04records: match-record: Support thunked and delayed fields....* guix/records.scm (match-record): Unwrap matched thunked and delayed fields. * tests/records.scm ("match-record, thunked field", "match-record, delayed field"): New tests. Signed-off-by: Josselin Poiret <dev@jpoiret.xyz> (unmatched-parenthesis d
2022-12-27records: match-record supports specifying a different variable name....An example: (match-record obj <my-type> (field1 (field2 custom-var-name) field3) ...) * guix/records.scm (match-record-inner): Add support for the new syntax. * tests/records.scm ("match-record, simple"): Add a simple test case for the new syntax. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Attila Lendvai
2022-12-02records: 'match-record' checks fields at macro-expansion time....This allows 'match-record' to be more efficient (field offsets are computed at compilation time) and to report unknown fields at macro-expansion time. * guix/records.scm (map-fields): New macro. (define-record-type*)[rtd-identifier]: New procedure. Define TYPE as a macro and use a separate identifier for the RTD. (lookup-field, match-record-inner): New macros. (match-record): Rewrite in terms of 'match-error-inner'. * tests/records.scm ("match-record, simple") ("match-record, unknown field"): New tests. * gnu/services/cuirass.scm (cuirass-shepherd-service): Rename 'log-file' local variable to 'main-log-file'. * gnu/services/getmail.scm (serialize-getmail-configuration-file): Move after <getmail-configuration-file> definition. Ludovic Courtès
2022-07-01tests: Add sanitizer test....* tests/records.scm ("define-record-type* & sanitize without default value"): New test. Ludovic Courtès
2021-08-12records: Support field sanitizers....* guix/records.scm (make-syntactic-constructor): Add #:sanitizers. [field-sanitizer]: New procedure. [wrap-field-value]: Honor F's sanitizer. (define-record-type*)[field-sanitizer]: New procedure. Pass #:sanitizer to 'make-syntactic-constructor'. * tests/records.scm ("define-record-type* & sanitize") ("define-record-type* & sanitize & thunked"): New tests. Ludovic Courtès