From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id St65M+zjSGQrKQAASxT56A (envelope-from ) for ; Wed, 26 Apr 2023 10:42:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id aMTcMuzjSGT2cgAA9RJhRA (envelope-from ) for ; Wed, 26 Apr 2023 10:42:20 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5B8A53B972 for ; Wed, 26 Apr 2023 10:42:20 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1praiI-0003z8-6C; Wed, 26 Apr 2023 04:41:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1praiF-0003yt-HK for emacs-orgmode@gnu.org; Wed, 26 Apr 2023 04:41:19 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prai7-0005aw-Uq for emacs-orgmode@gnu.org; Wed, 26 Apr 2023 04:41:18 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id A8BD02404C7 for ; Wed, 26 Apr 2023 10:41:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1682498469; bh=0zDue01nEoUJN6A9oUfbY2bQWDsd/fEaYxjInracOhs=; h=From:To:Cc:Subject:Date:From; b=db2cG9IBFm2Az0EgdBEKLnkQEdwvfmHA4ZCcBmOjI1NMPIMCSDHA5T+6O4Sl/7iYy Xpix03v7uzes/oJGqPHd62YURG3+zdECtjyYn0sDgPWzwbXV3eb7PSl9zry/DaryvO 2Sa6YQ04mYBvWkqLJR/O89VYxSkbHLWqYySXD2HsF2Ppm/zhwrU+C2pMUjLogcz2IQ cLDJkeGuj8qN/2bGzGNtcGbG9nl7+f2vIJbfWjMZKb0gD6pVnunAeoxNNHaYAadtB6 G+rdm5qqadruJwwHc1eHOgqOm38kfztH/zSZtnPjy5GTeJ40zryX4coLke0EYmz5yI D231o+/nW2+6A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Q5sln0HNvz6twx; Wed, 26 Apr 2023 10:41:08 +0200 (CEST) From: Ihor Radchenko To: Ruijie Yu Cc: Axel Kielhorn , emacs-orgmode@gnu.org Subject: Re: [DRAFT PATCH v5] Decouple LANG= and testing (was: Test failure due to LANG) In-Reply-To: References: <32E3D56A-9DDF-4D70-BBA6-2DB71919EC98@axelkielhorn.de> <37BA8B13-A49D-41A4-B752-4ED9540D5799@axelkielhorn.de> <871qkau9t6.fsf@localhost> <874jp64oxr.fsf@localhost> Date: Wed, 26 Apr 2023 08:44:07 +0000 Message-ID: <87cz3rowx4.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682498540; a=rsa-sha256; cv=none; b=E6/6nQqGXMXu7UyuMAboYTLAnPCe9sGLpguzer/vLjL8foafltZ5G5C1oA6zbdTwSuaWKl bhQUT5hwCuaprmqyNPUo7rXlAKICb431SMO2GdND9m4lFR71FWjnjsXqdWjs3ku032ba02 7TgM5TdqLwT8S+nJdAcbvZ00/zSjmEIscauuyi3FGAXE/9QS7J1G3Lgi6FNveQpQGtNdVb g9q8PBUyfvqOdBW0oUjNnDD6mT0bqie4Gs6b+Ng4umOJsc6XVgyG8F+vqqBTUzepcXOeh+ OuduZk6zKwwR+57cxiVGDjmP0TNA+kel1iL5kwYTyeEu1fWDrPPhyYzmnsR7jQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=db2cG9IB; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682498540; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=t1Dcda6AplHtRRAlQ7Qnxb0ZZRINub+Z8TuuXmht3+Y=; b=i6yND/CEpHmCOeCDO4jYI0u71vFxGSzwxDFDfuJpGMPTm7s/J9HD4fZFByjMz4vMfj8NxA nFa7i60qJog0UcLq+yC5y++wg5eI2kqKNa9U9gpeEuPcQFRFIhy3IXgzsH0M7cv/WG1+4O W6Gsd7P71bWEUwhJtavvh+JjUFFezcr5Ry+A4cSHWnbynE4B1d8tLy7QsHo8uw9BT+PMth X6xHWD/kszSIzma1nrXqyKQgzZnxUzsgQy4i8LVmkvwfoRpCFkntZZCkWb7249L71vl/RD YSdrTzzy9OdB0MBugFvtYfoKE9dP6Pm9kdrZsPh9EakWUMEZRP87sgrqOIfWcw== X-Migadu-Spam-Score: -7.50 X-Spam-Score: -7.50 X-Migadu-Queue-Id: 5B8A53B972 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=db2cG9IB; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-TUID: cqOoMpOmiVEH Ruijie Yu writes: > Ihor Radchenko writes: > >> (let ((org-time-stamp-formats '("%Y-%m-%d" . "%Y-%m-%d %H:%M"))) >> (org-element-timestamp-interpreter timestamp nil)) > > Thanks for the pointer. I have made this into a macro and redid my > changes accordingly. Please also let me know if more work should be > dedicated to avoid code duplication in tests (I see a lot of duplication > in the portions I touched in testing/lisp/test-org.el). Thanks! Some comments below. > +(defmacro org-test-with-result (result &rest body) ... > + (_ result)))) > + > +(defmacro org-test-without-dow (result &rest body) > + "Eval BODY skipping day-of-week in timestamps. > +See `org-test-with-result' for RESULT and the return value." > + (declare (indent 1)) > + `(let ((org-time-stamp-formats '("%Y-%m-%d" . "%Y-%m-%d %H:%M"))) > + ;; ,(macroexpand-1 `(org-test-with-result ,result ,@body)) > + (org-test-with-result ,result ,@body))) When reading the test code, this `org-test-without-dow' is quite confusing - the name suggests "day of week"-related, but RESULTS='buffer argument is doing something completely different. IMHO, it would be cleaner to: 1. (let ((org-time-stamp-formats ...)) ...) around the whole test. 2. Use `org-test-with-result' explicitly inside individual test clauses. > +(defconst org-test-day-of-weeks-abbrev > + (apply #'vector > + (seq-map (apply-partially #'format-time-string "%a") > + org-test-day-of-weeks-seconds)) > + "Vector of abbreviated names of days of week. > +See `org-test-day-of-weeks-seconds'.") > + > +(defconst org-test-day-of-weeks-full > + (apply #'vector > + (seq-map (apply-partially #'format-time-string "%A") > + org-test-day-of-weeks-seconds)) > + "Vector of full names for days of week. > +See `org-test-day-of-weeks-seconds'.") These constants make it necessary to write incantations like (sun (aref org-test-day-of-weeks-abbrev 0)) Why not creating a function like (org-test-translate-dow "Mon") or (org-test-translate-dow "Monday") that will do the same? It will be a lot more readable as well. You can then use an alist instead of vectors. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at