From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "N. Raghavendra" Newsgroups: gmane.emacs.devel Subject: Test comment-search-backward Date: Sun, 10 Sep 2017 17:54:57 +0530 Message-ID: <87wp56u4fa.fsf@gmail.com> Reply-To: "N. Raghavendra" NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1505046325 12486 195.159.176.226 (10 Sep 2017 12:25:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 10 Sep 2017 12:25:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 10 14:25:19 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dr1IQ-0002Mq-Hu for ged-emacs-devel@m.gmane.org; Sun, 10 Sep 2017 14:25:06 +0200 Original-Received: from localhost ([::1]:52888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr1IX-0002oZ-Qg for ged-emacs-devel@m.gmane.org; Sun, 10 Sep 2017 08:25:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dr1IQ-0002m5-TP for emacs-devel@gnu.org; Sun, 10 Sep 2017 08:25:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dr1IO-0007zS-AK for emacs-devel@gnu.org; Sun, 10 Sep 2017 08:25:06 -0400 Original-Received: from mail-pg0-x22e.google.com ([2607:f8b0:400e:c05::22e]:36718) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dr1IO-0007z1-3o for emacs-devel@gnu.org; Sun, 10 Sep 2017 08:25:04 -0400 Original-Received: by mail-pg0-x22e.google.com with SMTP id i130so3810014pgc.3 for ; Sun, 10 Sep 2017 05:25:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:user-agent:reply-to:mail-followup-to:date :message-id:mime-version:content-transfer-encoding; bh=gr10D4A+84Kxksqnz68k9oP0BfBOGCaqiudLfLHJ7XY=; b=eHqURKhfGiYkfwHY/ResBb9U7p2mj1wLs0AmLyXwMSIZswm/+1jT9TpXcHeCRr5mn+ bekMkLqu8Ss+1sgxn2vtLAcQ+7EUcxMuvgKN19Y4Gh/+rlVAwdctYBD0MYkBX719XVSO ADdYtl8XBtPltQw84/Nxuf3grZYVDiVXUW4XMrn2rAVeyOspSXVwv49I80jM+Rqgc/lb oaCxeIp23S8EtgTd6m28KLtXQrMmXZqjGod80bwKE7rqGI2tfgA+1TIJuzhb/iP7HvT9 4veTe4VLvvNUN+Vm3tm7xQco7h1pAWsCUnfvIVTM/m9xFn5dSQTSNTWGnoU/kMlEXfPg mIGw== 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:user-agent:reply-to :mail-followup-to:date:message-id:mime-version :content-transfer-encoding; bh=gr10D4A+84Kxksqnz68k9oP0BfBOGCaqiudLfLHJ7XY=; b=pjtidxw9SOTHdynpRsOFP91uXYupcq3TZMda/NfybPVzVyoQLfSyBzuMpOMSMq10Yh FMMw28N+Ruvx4MEAK4yHn7Ch6kp+/HSBAWQS46s0iOygtfQ+Lml+nLMtBLBmwmw9rp94 s1yCdeDyN5ovpmbDXRyt6WBMUaLlSafACQgXC3nf7maazn4RjbXgSGXbgGpwFwuhpju9 KDcVkpOPm1C1IRYdzB/VUUz7Au2N1v+1ObENYxs93XPFW1Fv0as2pKojWQt/T7uh8dUy n3OFAaHSCYu1epeX7p1qg90DyTWagVv+Fipkz/WpVWiTBwjJkawYt5/ACxRK7+bD5RNm Sbdg== X-Gm-Message-State: AHPjjUj2LCG5KZvxUXbyOU6pGRXqcdYSQlgIb29nENIdVkjO6JGdOC7q Sl67RaRDGUTk1rUD X-Google-Smtp-Source: ADKCNb7MPamocbek+BzI+NyLg4iIU3a9uJr0Kv/+oPdqnlsj1qZaN3A1/q03QBgY0ZUXBSxJffI9eg== X-Received: by 10.101.88.142 with SMTP id d14mr8490524pgu.36.1505046301743; Sun, 10 Sep 2017 05:25:01 -0700 (PDT) Original-Received: from ailuros (www.hri.res.in. [220.227.103.137]) by smtp.gmail.com with ESMTPSA id i2sm12195899pfd.21.2017.09.10.05.25.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Sep 2017 05:25:01 -0700 (PDT) Mail-Followup-To: emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:218088 Archived-At: I am using Emacs 26.0.50.1. While testing some functions that I had defined, I came across a behaviour of `comment-search-backward' that seems to be at odds with its docstring: ---------------------------------------------------------------------- (comment-search-backward &optional LIMIT NOERROR) Find a comment start between LIMIT and point. Moves point to inside the comment and returns the position of the comment-starter. If no comment is found, moves point to LIMIT and raises an error or returns nil if NOERROR is non-nil. Ensure that =E2=80=98comment-normalize-vars=E2=80=99 has been called before= you use this. ---------------------------------------------------------------------- Here is a file which, I think, defines a test of this behaviour: [/tmp]$ cat test.el ---------------------------------------------------------------------- (ert-deftest test-comment-search-backward-absent () "Test `comment-search-backward' when there is no comment in context. Check that when there is no comment in the portion of the buffer between the search limit and point, it moves point to the search limit and raises an error." (with-temp-buffer (emacs-lisp-mode) (comment-normalize-vars) (insert "(require 'foo) \(bar) ; first comment ;; second comment \(provide 'baz)") (let ((limit (save-excursion (search-backward "second")))) (should (equal (should-error (comment-search-backward limit)) '(error "No comment"))) (should (=3D (point) limit))))) ---------------------------------------------------------------------- Running the test fails: [/tmp]$ emacs -Q --batch --load=3Dtest.el --funcall=3Dert-run-tests-batch-a= nd-exit ---------------------------------------------------------------------- (ert-test-failed ((should (=3D (point) limit)) :form (=3D 70 41) :value nil)) FAILED 1/1 test-comment-search-backward-absent ---------------------------------------------------------------------- It looks like `comment-search-backward' does raise an error as promised, but does not move point to LIMIT from its previous position at the end of the buffer. Is there something I am missing? Thanks, Raghu. -- N. Raghavendra , http://www.retrotexts.net/ Harish-Chandra Research Institute, http://www.hri.res.in/