From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#45819: 28.0.50; time-stamp-tests failures Date: Tue, 12 Jan 2021 17:11:26 +0000 Message-ID: <878s8ynkqp.fsf@tcd.ie> References: <87im82nlht.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6641"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: stephen gildea To: 45819@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 12 18:20:59 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kzNLm-0001be-TM for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Jan 2021 18:20:59 +0100 Original-Received: from localhost ([::1]:58466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzNLl-0001fS-T2 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Jan 2021 12:20:57 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzND8-00087E-J2 for bug-gnu-emacs@gnu.org; Tue, 12 Jan 2021 12:12:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49666) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzND8-0003wF-Bm for bug-gnu-emacs@gnu.org; Tue, 12 Jan 2021 12:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kzND8-0007VY-6v for bug-gnu-emacs@gnu.org; Tue, 12 Jan 2021 12:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Jan 2021 17:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45819 X-GNU-PR-Package: emacs Original-Received: via spool by 45819-submit@debbugs.gnu.org id=B45819.161047149928815 (code B ref 45819); Tue, 12 Jan 2021 17:12:02 +0000 Original-Received: (at 45819) by debbugs.gnu.org; 12 Jan 2021 17:11:39 +0000 Original-Received: from localhost ([127.0.0.1]:32978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzNCk-0007Ug-8W for submit@debbugs.gnu.org; Tue, 12 Jan 2021 12:11:39 -0500 Original-Received: from mail-wm1-f48.google.com ([209.85.128.48]:34431) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzNCh-0007UP-Jb for 45819@debbugs.gnu.org; Tue, 12 Jan 2021 12:11:36 -0500 Original-Received: by mail-wm1-f48.google.com with SMTP id g25so2115921wmh.1 for <45819@debbugs.gnu.org>; Tue, 12 Jan 2021 09:11:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Vid4QNZCncmKW0JAx4rYaCFmM+7tYT33M40yuVCY324=; b=WxnBtwPHs28/v0nprCnB2zkfxJh/zoUK4mJKnVS1ABitcZ3S0tySKRLoWwY8UvEcdr SQTdkMT2AKZS//MePTep5L4vP03YclTDrL9DM4/FBWJuccGz4MQ+f93l18edXXSuDqwm ITjhtExJUyJglsm+APpjKu06q3w43Z9mFV+Z92AtxC8I6MVDP3RqdW/AnUoGc6V73gsU mUnAZKDY4L2C0hWIEb/FUIEFWVXHU1V9V/jI6puqRCEPHYtLg5kHQ45fDvrWrovEJ9le 3mAxeJi3+MGGoiQTYgZQT7a59+V/0Xo0eb9bwnWhyxKN4OSmVjBQBoKSFUimgSt777/l Zplw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Vid4QNZCncmKW0JAx4rYaCFmM+7tYT33M40yuVCY324=; b=UWGNx5RaZ6iIPqx1IWRPJ134TDchIDvs7VMdQVpfUJhtNsVEMLpeNzYoZuTm2scaS2 K47VVXnlNi46T2Wi0a5WvChcIkgQQa3vmlz0IdlVq1FyhBQhInHJqFXH5rU8rdl9QG66 HonLdq/Sm4J321AOPVBkbypU4rSuhnqnwqu6EVvrZEVEiHwTOaG8Uva7U4mz4YB+s8KA QViJhFF6dvrPKmhtz9o+2rGSW6KvGBX015xSeaoaZVjUtt98xM8x8kUAe710XrjsPFaI 6Oo90o8H64D5wV0qDp7Fe4C3yr0pzuRANYUsI4mIqhs9KWSAMoc5+P+bn1uezJ2vFdwd pe8w== X-Gm-Message-State: AOAM531LwryMChM9LHfsGO73PVwPa9UY9FkxhiJHoKu0IPeV992dHzKD pix6d5o69Z1j8cjx0hp8Xa95/e0JRsfxg5gI X-Google-Smtp-Source: ABdhPJwIG5tpUAVQ8k54YC71Azp4r53LQIeXodkPk2V1uB74/NUii6BnXVvuJvIxiOyTY97UFcg90A== X-Received: by 2002:a1c:3c04:: with SMTP id j4mr217295wma.177.1610471489250; Tue, 12 Jan 2021 09:11:29 -0800 (PST) Original-Received: from localhost ([2a02:8084:20e2:c380:d15:339e:aa10:60f1]) by smtp.gmail.com with ESMTPSA id h14sm5778132wrx.37.2021.01.12.09.11.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 09:11:28 -0800 (PST) In-Reply-To: <87im82nlht.fsf@tcd.ie> (Basil L. Contovounesios's message of "Tue, 12 Jan 2021 16:55:10 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:197811 Archived-At: --=-=-= Content-Type: text/plain "Basil L. Contovounesios" writes: > I've been seeing the attached failures in time-stamp-format-am-pm, > time-stamp-format-ignored-modifiers, and time-stamp-format-string-width > for a while now. > > My guess is that all three are failing because AM/PM format is not > supported in my locale, and so '%p' returns an empty string, as per > (info "(libc) Formatting Calendar Time"). > > Should the tests be changed to just also handle an empty/blank string, Perhaps something like the attached? Thanks, -- Basil --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-time-stamp-tests-for-non-AM-PM-locales.patch >From 39ef99ab39f7421cb515b41a9e8c5999ded1d5c8 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Tue, 12 Jan 2021 17:08:27 +0000 Subject: [PATCH] Fix time-stamp-tests for non-AM/PM locales * test/lisp/time-stamp-tests.el (with-time-stamp-test-env): Add Edebug spec. (time-stamp-format-am-pm, time-stamp-format-ignored-modifiers) (time-stamp-format-string-width): Handle locales which don't support AM/PM formats and return an empty string instead (bug#45819). --- test/lisp/time-stamp-tests.el | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 81488c3df1..c0c5e6dae5 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -26,7 +26,7 @@ (defmacro with-time-stamp-test-env (&rest body) "Evaluate BODY with some standard time-stamp test variables bound." - (declare (indent defun)) + (declare (debug (body)) (indent defun)) `(let ((user-login-name "test-logname") (user-full-name "100%d Tester") ;verify "%" passed unchanged (buffer-file-name "/emacs/test/time-stamped-file") @@ -481,16 +481,17 @@ time-stamp-format-year-4digit (should (equal (time-stamp-string "%Y" ref-time1) "2006")))) (ert-deftest time-stamp-format-am-pm () - "Test time-stamp formats for AM and PM strings." + "Test time-stamp formats for AM and PM strings. +Note that `%P' returns an empty string in some locales." (with-time-stamp-test-env ;; implemented and documented since 1997 - (should (equal (time-stamp-string "%#p" ref-time1) "pm")) - (should (equal (time-stamp-string "%#p" ref-time3) "am")) - (should (equal (time-stamp-string "%P" ref-time1) "PM")) - (should (equal (time-stamp-string "%P" ref-time3) "AM")) + (should (member (time-stamp-string "%#p" ref-time1) '("" "pm"))) + (should (member (time-stamp-string "%#p" ref-time3) '("" "am"))) + (should (member (time-stamp-string "%P" ref-time1) '("" "PM"))) + (should (member (time-stamp-string "%P" ref-time3) '("" "AM"))) ;; warned 1997-2019, changed in 2019 - (should (equal (time-stamp-string "%p" ref-time1) "PM")) - (should (equal (time-stamp-string "%p" ref-time3) "AM")))) + (should (member (time-stamp-string "%p" ref-time1) '("" "PM"))) + (should (member (time-stamp-string "%p" ref-time3) '("" "AM"))))) (ert-deftest time-stamp-format-day-number-in-week () "Test time-stamp formats for day number in week." @@ -565,10 +566,12 @@ time-stamp-format-non-date-conversions (should (equal (time-stamp-string "%q" ref-time1) "sysname-no-dots"))))) (ert-deftest time-stamp-format-ignored-modifiers () - "Test additional args allowed (but ignored) to allow for future expansion." + "Test additional args allowed (but ignored) to allow for future expansion. +Note that `%P' returns an empty string in some locales." (with-time-stamp-test-env ;; allowed modifiers - (should (equal (time-stamp-string "%.,@-+_ ^(stuff)P" ref-time3) "AM")) + (should (member (time-stamp-string "%.,@-+_ ^(stuff)P" ref-time3) + '(" " "AM"))) ;; not all punctuation is allowed (should-not (equal (time-stamp-string "%&P" ref-time3) "AM")))) @@ -578,13 +581,14 @@ time-stamp-format-non-conversions (should (equal (time-stamp-string "No percent" ref-time1) "No percent")))) (ert-deftest time-stamp-format-string-width () - "Test time-stamp string width modifiers." + "Test time-stamp string width modifiers. +Note that `%P' returns an empty string in some locales." (with-time-stamp-test-env ;; strings truncate on the right or are blank-padded on the left (should (equal (time-stamp-string "%0P" ref-time3) "")) - (should (equal (time-stamp-string "%1P" ref-time3) "A")) - (should (equal (time-stamp-string "%2P" ref-time3) "AM")) - (should (equal (time-stamp-string "%3P" ref-time3) " AM")) + (should (member (time-stamp-string "%1P" ref-time3) '(" " "A"))) + (should (member (time-stamp-string "%2P" ref-time3) '(" " "AM"))) + (should (member (time-stamp-string "%3P" ref-time3) '(" " " AM"))) (should (equal (time-stamp-string "%0%" ref-time3) "")) (should (equal (time-stamp-string "%1%" ref-time3) "%")) (should (equal (time-stamp-string "%2%" ref-time3) " %")) -- 2.29.2 --=-=-=--