From b5ddfdc53cf1cf2197adf8718ea405acfa2fe6f7 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sun, 21 Jan 2024 19:20:22 +0200 Subject: Refactor --- utils.scm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'utils.scm') diff --git a/utils.scm b/utils.scm index a131717..4647c07 100644 --- a/utils.scm +++ b/utils.scm @@ -1,14 +1,15 @@ -(module utils (inline-tests) - (import scheme - (chicken base) - (chicken process-context)) +(module utils (*should-run-inline-tests?* inline-tests) + (import (scheme) + (chicken process-context)) - (define-syntax inline-tests - (syntax-rules () - ((_ expr ...) - (let* ((v (get-environment-variable "INLINE_TESTS")) - (should-run-inline-tests? (and (string? v) - (string=? v "1")))) - (if should-run-inline-tests? - (begin expr ...))))))) + (define *should-run-inline-tests?* + (let ((v (get-environment-variable "INLINE_TESTS"))) + (and (string? v) + (string=? v "1")))) + + (define-syntax inline-tests + (syntax-rules () + ((_ expr ...) + (if *should-run-inline-tests?* + (begin expr ...)))))) -- cgit v1.3