From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0C6hLT++n2DeDAAAgWs5BA (envelope-from ) for ; Sat, 15 May 2021 14:27:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 2G1UKT++n2B+HAAA1q6Kng (envelope-from ) for ; Sat, 15 May 2021 12:27:43 +0000 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 17D8B2421D for ; Sat, 15 May 2021 14:27:43 +0200 (CEST) Received: from localhost ([::1]:57012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lhtOQ-0006FP-9O for larch@yhetil.org; Sat, 15 May 2021 08:27:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lhtNH-0006FC-DY for emacs-orgmode@gnu.org; Sat, 15 May 2021 08:26:31 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:39476) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lhtNF-0002gy-Ny; Sat, 15 May 2021 08:26:31 -0400 Received: by mail-wr1-x434.google.com with SMTP id v12so1728686wrq.6; Sat, 15 May 2021 05:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:cc:date:message-id :mime-version; bh=MXGmkxQqMF36qFFZQJ6ADkhQ0y0f1nJEvad3frBh7Oo=; b=dRaSUdNHgDLnRdWvX2yb6ewvzCiRnQGSrbmjvnzDWVoJgKeMI3TRa+2UGu48hpFIA1 Y3V5RTCAvZhySoaulbZvU+vUZcRP8XsejCPmLvLBfhS0qaHSBU11U5YUMRdxlNWjt+mL Nuz5tom8DXsZPBK/UsvFjChJl2TVZFKhlZmsS6ziw0kbgo6WjKEls5RcvxkgpKPC40Qh FgQG+XvcP7eYI/Rai2fsBSIBdLVG8qdEvBa5H59RfiYeEPdR4GNxwrTu9f9JKbWKmDeT WyxvDYXzm8ECBBO6S3kbhuS2m3Fv51FxlKPTU3ag9LMGBhVtmXaec7h4Pbj2Jbn8lPf7 Qx/A== 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:in-reply-to:references:cc:date :message-id:mime-version; bh=MXGmkxQqMF36qFFZQJ6ADkhQ0y0f1nJEvad3frBh7Oo=; b=m/TpynNKAIijQynYDgIFvV/U/Mv7Z9iDI6zRm8c7z7hFhRvlXAhqETMMx+HwzvR6U6 5u+BVfkt1WpFWsJmaCbdImIflf73cN/Ys+XcewQ6L2/YOZ7nWMxYy/3q+xwVIS/cgUj5 l4qsH0jXqrZ3vHit8r5F93phGTZwADGFevO/3cfmfHDXfeUMoveGvNUccH9iUFJ2GnGB A0sajk1QpIxtKQcg5uzoiJKe8EBrfykogWYd1CbFI6jvh55VAUJcKxk9l9ehD38CFm/B USfjah+Wg04uytAXZJam0ib3bD3SnO+h5OE4zhcQynVQ0kENsMeqC/RJGBsYLQEXNxIS PJoA== X-Gm-Message-State: AOAM533u0eH4/95fkJlzZxldWTXEvSDkF7RPP7tyt0eDdOSadsy07fG5 KnRP5GcFmSNa0TuP1/6/+DLtxFYOO/oKZA== X-Google-Smtp-Source: ABdhPJwbob5+Q/uTrpU+tySZ5DXS2Blt2czWoA4N8IkS2iavKRNC3jdtqttRXn2nBSWasN/Bq/kScw== X-Received: by 2002:a5d:53c3:: with SMTP id a3mr60354040wrw.376.1621081587728; Sat, 15 May 2021 05:26:27 -0700 (PDT) Received: from localhost ([141.105.67.194]) by smtp.gmail.com with ESMTPSA id v12sm7659037wru.73.2021.05.15.05.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 05:26:27 -0700 (PDT) From: Ihor Radchenko To: Bastien Subject: Re: [PATCH] Fix test-org-element/cache In-Reply-To: <87v97kfc4x.fsf@gnu.org> References: <87wns0jkg5.fsf@localhost> <87v97kfc4x.fsf@gnu.org> Date: Sat, 15 May 2021 20:31:19 +0800 Message-ID: <87wns0mb54.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=yantar92@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621081663; 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=MXGmkxQqMF36qFFZQJ6ADkhQ0y0f1nJEvad3frBh7Oo=; b=Mn8LRAAE48k+/rk9Ad5cU4ylFeYDZo0d7v5gyF9eACpr+vE3WDEEPtTpZwkoWxK8IqTPLh hXhQvorTDkYFXiEJwzXV2SiBnC4wtalxSOOkkf8W9LkyXnmzX5valhpViBcWPhxmrlBW/M sHajSucY1UAtdZe8+KQ+t+cY9kDgIkZSVPHSRJak8vwQT40JaJcuPM6hVtbHAYBIfzyVJb bXkfiUPCBIwgmASKDPWRxfRVngyBbxKWPlizhpV97WHNLdy3htOoDwCLnqhysoEMtXn8PI HWQojeAmgsRj2w6ywsB8E1HACq2Cmg7SoVZLdKfSfIcNH+RjkYEbToOkkZ8viQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621081663; a=rsa-sha256; cv=none; b=idwGhE5QWjlMwnLFRIkc4Xzi10Id5eqFho6cN/MGgk6unMLu3HUu3M8VnU7WWs0GP7FoXR DeyQFVlJAm2f6Ng7ytfC9dI9M6D1xduXeW8fEV/U2HKdupBvaggIj5av5KKjiqV33XQXiq SfPARF8R4JCLzB8x+o+YD5Xyi2ADyEtcEcoyMAC/y+E8FfNNTEObqJmw2jWDsVTKMHwkCg Z/COrunevpWLoDWx7BxtLESVzgsyl8OCw8mBPMviBfct5klecCJxnAWBrkdI+QP5hyjMGd GZYLdhtvT/LB8EaMhgs3b+xRBntNa3PeV5TnyvFL689UXKnTdLUu5a5n9n9D7A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=dRaSUdNH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.65 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=dRaSUdNH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 17D8B2421D X-Spam-Score: -2.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: o2yVoTlRJMh6 --=-=-= Content-Type: text/plain Bastien writes: > Applied in maint, thanks! The patch also revealed an idea for another test. The new test is revealing existing bug on master. Attached is the patch adding the test with ":expected-result :failed". --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-a-test-for-known-bug-in-org-element-cache.patch >From d3a5a606c64ed1da0d1880f503c2461839dbfec9 Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Sat, 15 May 2021 20:27:20 +0800 Subject: [PATCH] Add a test for known bug in org-element-cache * testing/lisp/test-org-element.el (test-org-element/cache-bugs): A new test documenting a known bug: 1. Create initial file like: P0 P1 | a | b | | c | d | Note that second line of the table is not indented. Now, org-element-at-point returns table-row. 2. Modify the file to test org-element-cache P0 - item P1 | a | b | | c | d | Now, the first (indented) row of the table belongs to item. The second row should be an individual table and org-element-at-point returns table. --- testing/lisp/test-org-element.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 28e9ecd12..18991b5bc 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -3889,6 +3889,21 @@ (ert-deftest test-org-element/cache () :end (org-element-property :parent (org-element-at-point))) (+ parent-end 3)))))) +(ert-deftest test-org-element/cache-bugs () + "Test basic expectations and common pitfalls for cache." + :expected-result :failed + ;; Unindented second row of the table should not be re-parented by + ;; inserted item. + (should + (eq 'table + (let ((org-element-use-cache t)) + (org-test-with-temp-text + "#+begin_center\nP0\n\n\n\n P1\n | a | b |\n| c | d |\n#+end_center" + (save-excursion (search-forward "| c |") (org-element-at-point)) + (insert "- item") + (search-forward "| c |") + (beginning-of-line) + (org-element-type (org-element-at-point))))))) (provide 'test-org-element) -- 2.26.3 --=-=-=--