From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#35476: Test suite Date: Tue, 30 Apr 2019 08:08:33 +0200 Message-ID: <87a7g8owim.fsf@gmail.com> References: <87lfzu9hsl.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="250142"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: 35476@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 30 08:09:12 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hLLx2-0012vB-GL for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Apr 2019 08:09:12 +0200 Original-Received: from localhost ([127.0.0.1]:39653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLLx1-0008VN-9x for geb-bug-gnu-emacs@m.gmane.org; Tue, 30 Apr 2019 02:09:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLLwt-0008Uv-JO for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 02:09:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLLws-0001Rn-BF for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 02:09:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55190) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLLws-0001Rd-48 for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 02:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hLLwr-00017n-Tj for bug-gnu-emacs@gnu.org; Tue, 30 Apr 2019 02:09:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87lfzu9hsl.fsf@gmail.com> Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Apr 2019 06:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35476 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35476-submit@debbugs.gnu.org id=B35476.15566045264293 (code B ref 35476); Tue, 30 Apr 2019 06:09:01 +0000 Original-Received: (at 35476) by debbugs.gnu.org; 30 Apr 2019 06:08:46 +0000 Original-Received: from localhost ([127.0.0.1]:40501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hLLwc-00017B-2v for submit@debbugs.gnu.org; Tue, 30 Apr 2019 02:08:46 -0400 Original-Received: from mail-wm1-f52.google.com ([209.85.128.52]:35145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hLLwZ-00016u-UZ for 35476@debbugs.gnu.org; Tue, 30 Apr 2019 02:08:44 -0400 Original-Received: by mail-wm1-f52.google.com with SMTP id y197so2440338wmd.0 for <35476@debbugs.gnu.org>; Mon, 29 Apr 2019 23:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:user-agent:mime-version; bh=e47KIZsE3WwmC1gtZPWsEJ8X0ClVPxyj8vAO4GEl4rk=; b=uOipOhxX8NCW3KhxPaGXOB4JhQXuenifopCkEYV33ZvRZBP4NpOUP5slIfREI9zJdQ j9drBsM5mDEOKFPvhG+F3NE79YfikrtajKMGf6L/F0/fwOvwGSPG9xJlM0rsa0s243Ow RxFW0DYeqgelEDQK+13XHLnUy2R/mYSNu8KURBj2+Ta9tA6RUMbHOcRnfeMnupDVHR7x RS4o9Vcqe3LsRGVB6h694dvJhKCnxtEIn8yb2zyhlWek2gwrx/kPxlzOSFzzMz4V9WXs WhFw0faoKJ55LGP5uXQG0MtoIrv2dDwHbKBxjfrVNJq/QOzJ/mtvtvGY/LOZV3iZ82aY t1ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=e47KIZsE3WwmC1gtZPWsEJ8X0ClVPxyj8vAO4GEl4rk=; b=OfouBmEcLK4wdpXeLUhyA3aFyFLBU1i4tuF8qF7OzLEQtYpSngmfgeIo9OLvvhKaaT 9hYI+Tzs6ThvgHdhIEDCVNY3STV1in1cs3kVkVOn45+ZuvwWwAxrgoFlNBYk1H5GFeoo esPtWqWXy7QkQCZXbJteCYqHxdwnGt7Gg/XU5vB45QJ78V+ELbqvnKfEVooTjbuUiljt I2YSUJerDKb95/IcZkPFaRwliuAPGWEx/U+SPhcgPF02ElmyLkpLWB/c7BbC3V2q44JT mheRNZBwWjieTC5hZc4BPAoVVV36rUXx4tZ9olh9gkp3vIw04lxAnuHW5ok1vhjbgODz fl3A== X-Gm-Message-State: APjAAAXus/IOLv+VliaeQyoBEoZQXr4plhQ90qCnKSA9BbIxFXI39QPp ReZwUuN6PFG3EZ77iSB+ThlziPiu X-Google-Smtp-Source: APXvYqwVrNbW4g/acz3reyPqZU9eUm+/IjHoLrU0a3AyDT+mk8Ak/IaTRa7evyoop26CxVXdGHWRVA== X-Received: by 2002:a7b:c00e:: with SMTP id c14mr525215wmb.110.1556604516946; Mon, 29 Apr 2019 23:08:36 -0700 (PDT) Original-Received: from my-little-tumbleweed (71.142.13.109.rev.sfr.net. [109.13.142.71]) by smtp.gmail.com with ESMTPSA id u8sm1574988wmj.27.2019.04.29.23.08.35 for <35476@debbugs.gnu.org> (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Apr 2019 23:08:35 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158479 Archived-At: --=-=-= Content-Type: text/plain As part of the discussion on help-gnu-emacs[1], Stefan applied a simpler patch in commit f478082f9f, only for font-lock-prepend-text-property though. Does it make sense to do the same in font-lock-append-text-property? As a learning experience with ERT, I wrote the attached test suite; with the current master branch, only the prepend test passes, the other fails. Applying the same change in font-lock-append-text-property lets both tests pass. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-a-test-suite-for-anonymous-face-handling-in-text.patch >From 7bd1a551de8cef452a7ade7eaa055d38bf3a0800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= Date: Tue, 30 Apr 2019 08:00:34 +0200 Subject: [PATCH] Add a test suite for anonymous face handling in text properties * test/lisp/font-lock-tests.el: New test suite. Only font-lock-test-prepend-anonymous-face passes as of f478082f9f. --- test/lisp/font-lock-tests.el | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/lisp/font-lock-tests.el diff --git a/test/lisp/font-lock-tests.el b/test/lisp/font-lock-tests.el new file mode 100644 index 0000000000..ad282f6cad --- /dev/null +++ b/test/lisp/font-lock-tests.el @@ -0,0 +1,43 @@ +;;; font-lock-tests.el --- Test suite for font-lock. -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: +(require 'ert) + +(ert-deftest font-lock-test-append-anonymous-face () + "Ensure `font-lock-append-text-property' does not splice anonymous faces." + (with-temp-buffer + (insert "foo") + (add-text-properties 1 3 '(face italic)) + (font-lock-append-text-property 1 3 'face '(:strike-through t)) + (should (equal (get-text-property 1 'face (current-buffer)) + '(italic (:strike-through t)))))) + +(ert-deftest font-lock-test-prepend-anonymous-face () + "Ensure `font-lock-prepend-text-property' does not splice anonymous faces." + (with-temp-buffer + (insert "foo") + (add-text-properties 1 3 '(face italic)) + (font-lock-prepend-text-property 1 3 'face '(:strike-through t)) + (should (equal (get-text-property 1 'face (current-buffer)) + '((:strike-through t) italic))))) + +(provide 'font-lock-tests) + +;; font-lock-tests.el ends here -- 2.21.0 --=-=-= Content-Type: text/plain Apologies for posting all over the place. [1]: http://lists.gnu.org/archive/html/help-gnu-emacs/2019-04/msg00289.html --=-=-=--