unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36063: [PATCH] Use lexical-binding in underline.el and add tests
@ 2019-06-02 23:21 Stefan Kangas
  2019-06-09  6:57 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Kangas @ 2019-06-02 23:21 UTC (permalink / raw)
  To: 36063


[-- Attachment #1.1: Type: text/plain, Size: 147 bytes --]

I've written unit tests and added the lexical-binding header to
underline.el.  Please let me know if you have any comments.

Thanks,
Stefan Kangas

[-- Attachment #1.2: Type: text/html, Size: 213 bytes --]

[-- Attachment #2: 0001-Use-lexical-binding-in-underline.el-and-add-tests.patch --]
[-- Type: application/octet-stream, Size: 2651 bytes --]

From 08184274c37c1df8bae6d40456ec094c1a0b7ea7 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Wed, 29 May 2019 15:59:21 +0200
Subject: [PATCH] Use lexical-binding in underline.el and add tests

* lisp/textmodes/underline.el: Use lexical-binding.
* test/lisp/textmodes/underline-tests.el: New file.
---
 lisp/textmodes/underline.el            |  2 +-
 test/lisp/textmodes/underline-tests.el | 42 ++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 test/lisp/textmodes/underline-tests.el

diff --git a/lisp/textmodes/underline.el b/lisp/textmodes/underline.el
index e0bfd24557..6d359f1d69 100644
--- a/lisp/textmodes/underline.el
+++ b/lisp/textmodes/underline.el
@@ -1,4 +1,4 @@
-;;; underline.el --- insert/remove underlining (done by overstriking) in Emacs
+;;; underline.el --- insert/remove underlining (done by overstriking) in Emacs  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
diff --git a/test/lisp/textmodes/underline-tests.el b/test/lisp/textmodes/underline-tests.el
new file mode 100644
index 0000000000..ce6a6c3185
--- /dev/null
+++ b/test/lisp/textmodes/underline-tests.el
@@ -0,0 +1,42 @@
+;;; underline-tests.el --- Tests for underline.el  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Free Software Foundation, Inc.
+
+;; Author: Stefan Kangas <stefankangas@gmail.com>
+
+;; 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 <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'ert)
+(require 'underline)
+
+(ert-deftest underline-tests-underline-region ()
+  (with-temp-buffer
+    (insert "foo bar baz")
+    (underline-region 5 8)
+    (should (equal (buffer-string) "foo _\C-hb_\C-ha_\C-hr baz"))))
+
+(ert-deftest underline-tests-ununderline-region ()
+  (with-temp-buffer
+    (insert "foo _\C-hb_\C-ha_\C-hr baz")
+    (ununderline-region 5 13)
+    (should (equal (buffer-string) "foo bar baz"))))
+
+(provide 'underline-tests)
+;;; underline-tests.el ends here
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#36063: [PATCH] Use lexical-binding in underline.el and add tests
  2019-06-02 23:21 bug#36063: [PATCH] Use lexical-binding in underline.el and add tests Stefan Kangas
@ 2019-06-09  6:57 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2019-06-09  6:57 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 36063-done

> From: Stefan Kangas <stefan@marxist.se>
> Date: Mon, 3 Jun 2019 01:21:06 +0200
> 
> I've written unit tests and added the lexical-binding header to
> underline.el.  Please let me know if you have any comments.

Thanks, pushed to the master branch (after adding the bug number to
the commit log message).





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-09  6:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-02 23:21 bug#36063: [PATCH] Use lexical-binding in underline.el and add tests Stefan Kangas
2019-06-09  6:57 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).