From unknown Sun Jun 22 07:47:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24935: [PATCH] Add tests for rot13.el Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Nov 2016 11:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24935 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 24935@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.147903527414502 (code B ref -1); Sun, 13 Nov 2016 11:08:01 +0000 Received: (at submit) by debbugs.gnu.org; 13 Nov 2016 11:07:54 +0000 Received: from localhost ([127.0.0.1]:55430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5sdd-0003lq-Q8 for submit@debbugs.gnu.org; Sun, 13 Nov 2016 06:07:54 -0500 Received: from eggs.gnu.org ([208.118.235.92]:32958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5sdb-0003lc-QB for submit@debbugs.gnu.org; Sun, 13 Nov 2016 06:07:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5sdV-0003NE-9U for submit@debbugs.gnu.org; Sun, 13 Nov 2016 06:07:46 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52230) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c5sdV-0003N3-5v for submit@debbugs.gnu.org; Sun, 13 Nov 2016 06:07:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5sdT-0003Ui-Qj for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2016 06:07:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5sdQ-0003KG-LL for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2016 06:07:43 -0500 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]:35927) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c5sdQ-0003KA-Cx for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2016 06:07:40 -0500 Received: by mail-lf0-x22f.google.com with SMTP id t196so40364693lff.3 for ; Sun, 13 Nov 2016 03:07:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:message-id:mime-version; bh=U7PaNUR7w6U3tZnMsqW5ozrVHN/hXXg9sAhHQ+0ZhVY=; b=UqqjCKndp6y6/9/p16cPjh8COMTsefkntX/zeIA1fkEA7l5kfKf3hrxymsZyUMrKlD orHhVh4CYQGJY4Pxv0OHq64Mrp8GRcZW0o0Jzks/gvHSZIEBVIT0+DSr4Lly1F65Y1Vc oja/ru5xQeO4tRH1GVULkm3C3PKXm61kd85RaU8oWA/h3alVcIFxW35Z4iNqrbU40NEi 1zWVysKAYL/lvEBUaeJY25I2FrK39IwWi54ZVvqbBJH0WfPZHvUvBOAEa1h8miCwQ+k7 JSTPWmyUrrgTxl0aU3PT0I1CXP6uekD0K76u6SQIhUBOXOH/3sRN/oTDvYRkFaHiJrYL 37Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:message-id:mime-version; bh=U7PaNUR7w6U3tZnMsqW5ozrVHN/hXXg9sAhHQ+0ZhVY=; b=gqivE4THbqg9djDfJl0OXJjBPs0PvV9ZE10yKJRFkID7SoRLDgAasBE6Az3WKdpdJk hXnpJDeOkG7wJDAzkf6OpCcYo4gnwL9faKhgb5jo4nN1xG+89pFJHYs5POwOnQhF01ws r1ddErViiEgHhSjGA9mM3neT0K5LdgINo0ZD+wHY3KXaWxpbOMVu30PR4eTT9g4SQyOu zh3Bf1mO1wCYOknBM1pw+uVtAjfUCM5G5L+hMAPzvP1wnI6vWqGUVklp42kEuwGi75/u zbGpDNR0TnLN7I0uLpupKw3h9Ehy5k4gEaBegSyxbtwQhh2a6IVSlZ8yYpmU2NC9p462 CqgQ== X-Gm-Message-State: ABUngvd3iA8U1hqGq9UlcEjT4rBxujgfpk23ElncTiKGxO9Mt/j57xte0DNZSbZxpONvnA== X-Received: by 10.25.209.136 with SMTP id i130mr5853199lfg.1.1479035258706; Sun, 13 Nov 2016 03:07:38 -0800 (PST) Received: from [192.168.100.6] (cm-84.210.143.4.getinternet.no. [84.210.143.4]) by smtp.gmail.com with ESMTPSA id l141sm4065984lfl.0.2016.11.13.03.07.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Nov 2016 03:07:37 -0800 (PST) Date: Sun, 13 Nov 2016 12:07:36 +0100 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Message-Id: <1479035256.4382.0@smtp.gmail.com> X-Mailer: geary/0.11.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-0Muyjm99LZuwmUcSye99" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-0Muyjm99LZuwmUcSye99 Content-Type: text/plain; charset=utf-8; format=flowed Hello, I saw that there weren't any tests for rot13.el yet, so I wrote some. I also made a docstring correction along the way. Unless there are any objections, I'll install the patch within a few days. I also plan to turn on lexical binding for rot13.el in a follow-up commit. -- Simen --=-0Muyjm99LZuwmUcSye99 Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-tests-for-rot13.el.patch Content-Transfer-Encoding: quoted-printable >From 3d69adedc05c1e6e5c94144160ba80b23f174b80 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Simen=3D20Heggest=3DC3=3DB8yl?=3D Date: Sat, 12 Nov 2016 12:48:51 +0100 Subject: [PATCH] Add tests for rot13.el * lisp/rot13.el (rot13): Docstring correction. * test/lisp/rot13-tests.el: New file with tests for rot13.el. --- lisp/rot13.el | 3 ++- test/lisp/rot13-tests.el | 54 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 test/lisp/rot13-tests.el diff --git a/lisp/rot13.el b/lisp/rot13.el index ee4f51d..dae1517 100644 --- a/lisp/rot13.el +++ b/lisp/rot13.el @@ -63,7 +63,8 @@ rot13-translate-table =20 ;;;###autoload (defun rot13 (object &optional start end) - "Return ROT13 encryption of OBJECT, a buffer or string." + "ROT13 encrypt OBJECT, a buffer or string. +Return the ROT13 encrypted string when OBJECT is a string." (if (bufferp object) (with-current-buffer object (rot13-region start end)) diff --git a/test/lisp/rot13-tests.el b/test/lisp/rot13-tests.el new file mode 100644 index 0000000..a31dc50 --- /dev/null +++ b/test/lisp/rot13-tests.el @@ -0,0 +1,54 @@ +;;; rot13-tests.el --- Tests for rot13.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Simen Heggest=C3=B8yl +;; Keywords: + +;; 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 . + +;;; Commentary: + +;; + +;;; Code: + +(require 'ert) +(require 'rot13) + +(ert-deftest rot13-tests-rot13 () + (should (equal (rot13 "Super-secret text") "Fhcre-frperg grkg")) + (with-temp-buffer + (insert "Super-secret text") + (rot13 (current-buffer) (point-min) (point-max)) + (should (equal (buffer-string) "Fhcre-frperg grkg")) + (rot13 (current-buffer) (point-min) (+ (point-min) 5)) + (should (equal (buffer-string) "Super-frperg grkg")))) + +(ert-deftest rot13-tests-rot13-string () + (should (equal (rot13-string "") "")) + (should (equal (rot13-string (rot13-string "foo")) "foo")) + (should (equal (rot13-string "Super-secret text") + "Fhcre-frperg grkg"))) + +(ert-deftest rot13-tests-rot13-region () + (with-temp-buffer + (insert "Super-secret text") + (rot13-region (+ (point-min) 6) (+ (point-min) 12)) + (should (equal (buffer-string) "Super-frperg text")))) + +(provide 'rot13-tests) +;;; rot13-tests.el ends here --=20 2.10.2 = --=-0Muyjm99LZuwmUcSye99-- From unknown Sun Jun 22 07:47:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24935: [PATCH] Add tests for rot13.el Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Nov 2016 15:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24935 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 24935@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 24935-submit@debbugs.gnu.org id=B24935.147905157320911 (code B ref 24935); Sun, 13 Nov 2016 15:40:02 +0000 Received: (at 24935) by debbugs.gnu.org; 13 Nov 2016 15:39:33 +0000 Received: from localhost ([127.0.0.1]:56005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5wsW-0005RD-PH for submit@debbugs.gnu.org; Sun, 13 Nov 2016 10:39:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43261) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5wsU-0005Qw-R1 for 24935@debbugs.gnu.org; Sun, 13 Nov 2016 10:39:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5wsM-0007w2-J6 for 24935@debbugs.gnu.org; Sun, 13 Nov 2016 10:39:25 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5wsM-0007vy-GH; Sun, 13 Nov 2016 10:39:22 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4837 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1c5wsL-0000SS-Ta; Sun, 13 Nov 2016 10:39:22 -0500 Date: Sun, 13 Nov 2016 17:39:31 +0200 Message-Id: <83eg2fcrt8.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <1479035256.4382.0@smtp.gmail.com> (message from Simen =?UTF-8?Q?Heggest=C3=B8yl?= on Sun, 13 Nov 2016 12:07:36 +0100) References: <1479035256.4382.0@smtp.gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -7.8 (-------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -7.8 (-------) > Date: Sun, 13 Nov 2016 12:07:36 +0100 > From: Simen Heggestøyl > > I saw that there weren't any tests for rot13.el yet, so I wrote > some. I also made a docstring correction along the way. Thanks. A comment below. > Unless there are any objections, I'll install the patch within a few > days. To the master branch, please. > ;;;###autoload > (defun rot13 (object &optional start end) > - "Return ROT13 encryption of OBJECT, a buffer or string." > + "ROT13 encrypt OBJECT, a buffer or string. > +Return the ROT13 encrypted string when OBJECT is a string." If we are going to fix the doc string, let's also document START and END, and tell that they are ignored if OBJECT is a string. From unknown Sun Jun 22 07:47:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24935: [PATCH] Add tests for rot13.el Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Nov 2016 18:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24935 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: 24935@debbugs.gnu.org Received: via spool by 24935-submit@debbugs.gnu.org id=B24935.147923544331161 (code B ref 24935); Tue, 15 Nov 2016 18:45:02 +0000 Received: (at 24935) by debbugs.gnu.org; 15 Nov 2016 18:44:03 +0000 Received: from localhost ([127.0.0.1]:58478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6iiB-00086W-KU for submit@debbugs.gnu.org; Tue, 15 Nov 2016 13:44:03 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6iiA-00085u-Va for 24935@debbugs.gnu.org; Tue, 15 Nov 2016 13:44:03 -0500 Received: by mail-wm0-f53.google.com with SMTP id f82so18017760wmf.1 for <24935@debbugs.gnu.org>; Tue, 15 Nov 2016 10:44:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:cc:message-id:in-reply-to:references :mime-version; bh=bdg6qHB8+bHAa6o81p6f5S/txh43yhdwst9CP9MZozk=; b=rFHvX8tIWf4Fn9FfXvYvXqaiAxESGmVAHsEXGyvmqWIv8w2twLGdimGYBsasOtvL4o 1AQzOTIY01hFnPJHNzdl6f5D2Q1BK0+umCFCWnfqrvmxKhfyKLXWuU6xDQR/J14loQ4h UAqyIqF0T4Rle7E0v5IpIIm78v1FksyqOc4DLf1E2DrU/AtaUl+36A5/lO63QzH7T53y I1e6bxrmccaj/kG02VVo9sQ6S6lqITxJUhjcIOZ+wP43XB3TDlkVlL90Ca2a4FDPTCGO JaN0xrl1hVBVoAp2TGr/sV140lx+aaWQ6uJxp34CJnLD51TtAGmSPvv1OFFc81HYRtzt eYXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:cc:message-id:in-reply-to :references:mime-version; bh=bdg6qHB8+bHAa6o81p6f5S/txh43yhdwst9CP9MZozk=; b=aG6Q2E257U2sjaWN09mzz3PtfslIwICXBsXEXolAZbVV84ENBHkXeOHNRDcQnN2R1P hsOh08lBpG2XglH+ARf+u+xN70OAzWhsOnAGKvJFAt9Nx1/axfSYxbzobK/d/igXM8FE OgQgIj+2RgVM+3ign5LkoAHCivDh0pCvDchDMwXTZOinAh4IfhHvu/PxAT+4liH1BMlD Z8+RrXxn35IaPKNIuueMScJf5czAY07lxhHUwUqwnAw/v7MCahjAyiRrtjXD1UC8zUhG qR34GCHwDsRrAMz/iZE7Y9Gy9r19xVGJXvQMLmUiSRN+qAp9HNajZxmRH5FLo8T4/WW4 0pwA== X-Gm-Message-State: ABUngve/zr0fVmFLK8M0Q2IjBJsW7onZkM8UfKrAlHRt9TbyrWTdb2O1zEpZY2Cslo1g5g== X-Received: by 10.25.25.71 with SMTP id 68mr10209761lfz.9.1479235437183; Tue, 15 Nov 2016 10:43:57 -0800 (PST) Received: from [192.168.100.6] (cm-84.210.143.4.getinternet.no. [84.210.143.4]) by smtp.gmail.com with ESMTPSA id c78sm6696467lfc.34.2016.11.15.10.43.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Nov 2016 10:43:56 -0800 (PST) Date: Tue, 15 Nov 2016 19:43:55 +0100 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Message-Id: <1479235435.2503.2@smtp.gmail.com> In-Reply-To: <83eg2fcrt8.fsf@gnu.org> References: <1479035256.4382.0@smtp.gmail.com> <1479035256.4382.0@smtp.gmail.com> X-Mailer: geary/0.11.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) On Sun, Nov 13, 2016 at 4:39 PM, Eli Zaretskii wrote: > If we are going to fix the doc string, let's also document START and > END, and tell that they are ignored if OBJECT is a string. I agree. How about the following? "ROT13 encrypt OBJECT, a buffer or string. Return the ROT13 encrypted string when OBJECT is a string, ignoring START and END. ROT13 encrypt the region between positions START and END when OBJECT is a buffer; all three arguments are then required." -- Simen From unknown Sun Jun 22 07:47:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24935: [PATCH] Add tests for rot13.el Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Nov 2016 20:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24935 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 24935@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 24935-submit@debbugs.gnu.org id=B24935.14792414288089 (code B ref 24935); Tue, 15 Nov 2016 20:24:01 +0000 Received: (at 24935) by debbugs.gnu.org; 15 Nov 2016 20:23:48 +0000 Received: from localhost ([127.0.0.1]:58525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6kGh-00026O-Qc for submit@debbugs.gnu.org; Tue, 15 Nov 2016 15:23:48 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6kGg-00026A-JN for 24935@debbugs.gnu.org; Tue, 15 Nov 2016 15:23:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c6kGW-0008J7-IA for 24935@debbugs.gnu.org; Tue, 15 Nov 2016 15:23:41 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAD_ENC_HEADER,BAYES_05, RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c6kGW-0008J2-ER; Tue, 15 Nov 2016 15:23:36 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3511 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1c6kGV-0001Nn-Qy; Tue, 15 Nov 2016 15:23:36 -0500 Date: Tue, 15 Nov 2016 22:23:32 +0200 Message-Id: <838tskh4qj.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <1479235435.2503.2@smtp.gmail.com> (message from Simen =?UTF-8?Q?Heggest=C3=B8yl?= on Tue, 15 Nov 2016 19:43:55 +0100) References: <1479035256.4382.0@smtp.gmail.com> <1479035256.4382.0@smtp.gmail.com> <1479235435.2503.2@smtp.gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -7.8 (-------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -7.8 (-------) > Date: Tue, 15 Nov 2016 19:43:55 +0100 > From: Simen Heggestøyl > Cc: 24935@debbugs.gnu.org > > "ROT13 encrypt OBJECT, a buffer or string. > Return the ROT13 encrypted string when OBJECT is a string, > ignoring START and END. ROT13 encrypt the region between > positions START and END when OBJECT is a buffer; all three > arguments are then required." It sounds strange to describe first the use case where the arguments are ignored. I suggest this instead: ROT13 encrypt OBJECT, a buffer or string. If OBJECT is a buffer, encrypt the region between START and END. If OBJECT is a string, encrypt it in its entirety, ignoring START and END, and return the encrypted string. From unknown Sun Jun 22 07:47:55 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Subject: bug#24935: closed (Re: bug#24935: [PATCH] Add tests for rot13.el) Message-ID: References: <1479406997.5107.0@smtp.gmail.com> <1479035256.4382.0@smtp.gmail.com> X-Gnu-PR-Message: they-closed 24935 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 24935@debbugs.gnu.org Date: Thu, 17 Nov 2016 18:24:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1479407042-9609-1" This is a multi-part message in MIME format... ------------=_1479407042-9609-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24935: [PATCH] Add tests for rot13.el which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 24935@debbugs.gnu.org. --=20 24935: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24935 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1479407042-9609-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24935-done) by debbugs.gnu.org; 17 Nov 2016 18:23:26 +0000 Received: from localhost ([127.0.0.1]:60943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c7RLK-0002Tw-EM for submit@debbugs.gnu.org; Thu, 17 Nov 2016 13:23:26 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:38503) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c7RLI-0002Tj-Vo for 24935-done@debbugs.gnu.org; Thu, 17 Nov 2016 13:23:25 -0500 Received: by mail-wm0-f45.google.com with SMTP id f82so163734998wmf.1 for <24935-done@debbugs.gnu.org>; Thu, 17 Nov 2016 10:23:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:cc:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OHvVqyzv9/Xl+M6yRaSeiJ6M81nyqASKzOeG9figsUk=; b=Pcoajdocgufh7ulFHWrh0uJfg1OgspcSZAx8fDaGolrlEYp1lBDXiVCAybZmOvRyhW eqaWFAMxPBUtt0vnn73g6i2tcP/XXJB+l/Hux3HcqqZxz5PaAcZmYLLua/Xnq04lIeHb PWNBuCqEgqhVW34GoDbvMr5U5l6Zec58eh9h89mNo+ILwRoFIElxaq2iGS5ZkG+A1yAa mIkoq/wUCZ8pKNo32ciJTn3tI2Sdogm1tfO+iJLzpkyhVMJTWBzShZzt4r/osj4sGKBp m592fe55GAOcqeiMe/8gImIRv64W8CwQPBdVuGazOUEi0iQn1falETJUGjQRsye5twxf fcNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:cc:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OHvVqyzv9/Xl+M6yRaSeiJ6M81nyqASKzOeG9figsUk=; b=lf2/9+xwFTDk6xBka8DaAh66OvaCXIsTa+7CtqFFnVskYIhErKRrNVClFlv9Lb5Qln MS6uIGa7ffX+kDE1KPwDL4P5UlVtyKEX7rbvvBXtNQn++COTu1xvrgQfarIUZsKad4sT yzP28PAET3mMP4zVW45vuiysQZdsajXKwlB1ZFwM55dleReckKArd70U27Jj4vmfkbjy aMg8N9MQlOfdz7FNq9Tf0jKAczy32RpS7tMRFD5ZQPqLqBVmoC6lz8o/o1rstfzg9r+M yI2mp7zSrI1LpivWZQqytNfJ71ZZtv3ou7WsjX08bRxPYmb4DuUkHFmuVhdWlpJKznI0 huFA== X-Gm-Message-State: AKaTC02Dpv7qRf0Q3mFhwUKCXk7YMDWTZBz8IVtLxg81NhlIJYtJWbAmsuw2RV+TCDlcxw== X-Received: by 10.46.71.140 with SMTP id u134mr2134234lja.19.1479406999327; Thu, 17 Nov 2016 10:23:19 -0800 (PST) Received: from [192.168.100.6] (cm-84.210.143.4.getinternet.no. [84.210.143.4]) by smtp.gmail.com with ESMTPSA id g84sm1086899ljg.31.2016.11.17.10.23.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Nov 2016 10:23:18 -0800 (PST) Date: Thu, 17 Nov 2016 19:23:17 +0100 From: Simen =?iso-8859-1?q?Heggest=F8yl?= Subject: Re: bug#24935: [PATCH] Add tests for rot13.el To: Eli Zaretskii Message-Id: <1479406997.5107.0@smtp.gmail.com> In-Reply-To: <838tskh4qj.fsf@gnu.org> References: <1479035256.4382.0@smtp.gmail.com> <1479035256.4382.0@smtp.gmail.com> X-Mailer: geary/0.11.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 24935-done Cc: 24935-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) Sounds good to me, thanks. Installed with your suggested change. -- Simen On Tue, Nov 15, 2016 at 9:23 PM, Eli Zaretskii wrote: >> Date: Tue, 15 Nov 2016 19:43:55 +0100 >> From: Simen Heggest=C3=B8yl >> Cc: 24935@debbugs.gnu.org >>=20 >> "ROT13 encrypt OBJECT, a buffer or string. >> Return the ROT13 encrypted string when OBJECT is a string, >> ignoring START and END. ROT13 encrypt the region between >> positions START and END when OBJECT is a buffer; all three >> arguments are then required." >=20 > It sounds strange to describe first the use case where the arguments > are ignored. I suggest this instead: >=20 > ROT13 encrypt OBJECT, a buffer or string. > If OBJECT is a buffer, encrypt the region between START and END. > If OBJECT is a string, encrypt it in its entirety, ignoring START > and END, and return the encrypted string. >=20 >=20 >=20 = ------------=_1479407042-9609-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 Nov 2016 11:07:54 +0000 Received: from localhost ([127.0.0.1]:55430 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5sdd-0003lq-Q8 for submit@debbugs.gnu.org; Sun, 13 Nov 2016 06:07:54 -0500 Received: from eggs.gnu.org ([208.118.235.92]:32958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c5sdb-0003lc-QB for submit@debbugs.gnu.org; Sun, 13 Nov 2016 06:07:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5sdV-0003NE-9U for submit@debbugs.gnu.org; Sun, 13 Nov 2016 06:07:46 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52230) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c5sdV-0003N3-5v for submit@debbugs.gnu.org; Sun, 13 Nov 2016 06:07:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52162) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5sdT-0003Ui-Qj for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2016 06:07:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5sdQ-0003KG-LL for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2016 06:07:43 -0500 Received: from mail-lf0-x22f.google.com ([2a00:1450:4010:c07::22f]:35927) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c5sdQ-0003KA-Cx for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2016 06:07:40 -0500 Received: by mail-lf0-x22f.google.com with SMTP id t196so40364693lff.3 for ; Sun, 13 Nov 2016 03:07:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:message-id:mime-version; bh=U7PaNUR7w6U3tZnMsqW5ozrVHN/hXXg9sAhHQ+0ZhVY=; b=UqqjCKndp6y6/9/p16cPjh8COMTsefkntX/zeIA1fkEA7l5kfKf3hrxymsZyUMrKlD orHhVh4CYQGJY4Pxv0OHq64Mrp8GRcZW0o0Jzks/gvHSZIEBVIT0+DSr4Lly1F65Y1Vc oja/ru5xQeO4tRH1GVULkm3C3PKXm61kd85RaU8oWA/h3alVcIFxW35Z4iNqrbU40NEi 1zWVysKAYL/lvEBUaeJY25I2FrK39IwWi54ZVvqbBJH0WfPZHvUvBOAEa1h8miCwQ+k7 JSTPWmyUrrgTxl0aU3PT0I1CXP6uekD0K76u6SQIhUBOXOH/3sRN/oTDvYRkFaHiJrYL 37Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:message-id:mime-version; bh=U7PaNUR7w6U3tZnMsqW5ozrVHN/hXXg9sAhHQ+0ZhVY=; b=gqivE4THbqg9djDfJl0OXJjBPs0PvV9ZE10yKJRFkID7SoRLDgAasBE6Az3WKdpdJk hXnpJDeOkG7wJDAzkf6OpCcYo4gnwL9faKhgb5jo4nN1xG+89pFJHYs5POwOnQhF01ws r1ddErViiEgHhSjGA9mM3neT0K5LdgINo0ZD+wHY3KXaWxpbOMVu30PR4eTT9g4SQyOu zh3Bf1mO1wCYOknBM1pw+uVtAjfUCM5G5L+hMAPzvP1wnI6vWqGUVklp42kEuwGi75/u zbGpDNR0TnLN7I0uLpupKw3h9Ehy5k4gEaBegSyxbtwQhh2a6IVSlZ8yYpmU2NC9p462 CqgQ== X-Gm-Message-State: ABUngvd3iA8U1hqGq9UlcEjT4rBxujgfpk23ElncTiKGxO9Mt/j57xte0DNZSbZxpONvnA== X-Received: by 10.25.209.136 with SMTP id i130mr5853199lfg.1.1479035258706; Sun, 13 Nov 2016 03:07:38 -0800 (PST) Received: from [192.168.100.6] (cm-84.210.143.4.getinternet.no. [84.210.143.4]) by smtp.gmail.com with ESMTPSA id l141sm4065984lfl.0.2016.11.13.03.07.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 Nov 2016 03:07:37 -0800 (PST) Date: Sun, 13 Nov 2016 12:07:36 +0100 From: Simen =?iso-8859-1?q?Heggest=F8yl?= Subject: [PATCH] Add tests for rot13.el To: bug-gnu-emacs@gnu.org Message-Id: <1479035256.4382.0@smtp.gmail.com> X-Mailer: geary/0.11.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-0Muyjm99LZuwmUcSye99" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-0Muyjm99LZuwmUcSye99 Content-Type: text/plain; charset=utf-8; format=flowed Hello, I saw that there weren't any tests for rot13.el yet, so I wrote some. I also made a docstring correction along the way. Unless there are any objections, I'll install the patch within a few days. I also plan to turn on lexical binding for rot13.el in a follow-up commit. -- Simen --=-0Muyjm99LZuwmUcSye99 Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-tests-for-rot13.el.patch Content-Transfer-Encoding: quoted-printable >From 3d69adedc05c1e6e5c94144160ba80b23f174b80 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Simen=3D20Heggest=3DC3=3DB8yl?=3D Date: Sat, 12 Nov 2016 12:48:51 +0100 Subject: [PATCH] Add tests for rot13.el * lisp/rot13.el (rot13): Docstring correction. * test/lisp/rot13-tests.el: New file with tests for rot13.el. --- lisp/rot13.el | 3 ++- test/lisp/rot13-tests.el | 54 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 test/lisp/rot13-tests.el diff --git a/lisp/rot13.el b/lisp/rot13.el index ee4f51d..dae1517 100644 --- a/lisp/rot13.el +++ b/lisp/rot13.el @@ -63,7 +63,8 @@ rot13-translate-table =20 ;;;###autoload (defun rot13 (object &optional start end) - "Return ROT13 encryption of OBJECT, a buffer or string." + "ROT13 encrypt OBJECT, a buffer or string. +Return the ROT13 encrypted string when OBJECT is a string." (if (bufferp object) (with-current-buffer object (rot13-region start end)) diff --git a/test/lisp/rot13-tests.el b/test/lisp/rot13-tests.el new file mode 100644 index 0000000..a31dc50 --- /dev/null +++ b/test/lisp/rot13-tests.el @@ -0,0 +1,54 @@ +;;; rot13-tests.el --- Tests for rot13.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2016 Free Software Foundation, Inc. + +;; Author: Simen Heggest=C3=B8yl +;; Keywords: + +;; 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 . + +;;; Commentary: + +;; + +;;; Code: + +(require 'ert) +(require 'rot13) + +(ert-deftest rot13-tests-rot13 () + (should (equal (rot13 "Super-secret text") "Fhcre-frperg grkg")) + (with-temp-buffer + (insert "Super-secret text") + (rot13 (current-buffer) (point-min) (point-max)) + (should (equal (buffer-string) "Fhcre-frperg grkg")) + (rot13 (current-buffer) (point-min) (+ (point-min) 5)) + (should (equal (buffer-string) "Super-frperg grkg")))) + +(ert-deftest rot13-tests-rot13-string () + (should (equal (rot13-string "") "")) + (should (equal (rot13-string (rot13-string "foo")) "foo")) + (should (equal (rot13-string "Super-secret text") + "Fhcre-frperg grkg"))) + +(ert-deftest rot13-tests-rot13-region () + (with-temp-buffer + (insert "Super-secret text") + (rot13-region (+ (point-min) 6) (+ (point-min) 12)) + (should (equal (buffer-string) "Super-frperg text")))) + +(provide 'rot13-tests) +;;; rot13-tests.el ends here --=20 2.10.2 = --=-0Muyjm99LZuwmUcSye99-- ------------=_1479407042-9609-1--