aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-06-13 02:48:41 +0200
committerLars Ingebrigtsen2019-06-13 02:48:41 +0200
commit5b7ec43c6103dcaa6687773f626e81dae4fdda19 (patch)
treefa766fd32c3fa7813eb4bc1486fa9e90bad97f00
parentb334124a23f24b4d66da62fc99d92ebdefdd0756 (diff)
downloademacs-5b7ec43c6103dcaa6687773f626e81dae4fdda19.tar.gz
emacs-5b7ec43c6103dcaa6687773f626e81dae4fdda19.zip
Add ps-mode-tests.el and remove a compilation warning
* lisp/progmodes/ps-mode.el (ps-mode-octal-region): Remove a string-make-unibyte that apparently had no effect here. * test/lisp/progmodes/ps-mode-tests.el: New file.
-rw-r--r--lisp/progmodes/ps-mode.el3
-rw-r--r--test/lisp/progmodes/ps-mode-tests.el37
2 files changed, 39 insertions, 1 deletions
diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el
index 92824b63e68..cf09b98b491 100644
--- a/lisp/progmodes/ps-mode.el
+++ b/lisp/progmodes/ps-mode.el
@@ -738,7 +738,8 @@ Only one `%' is removed, and it has to be in the first column."
738 (while (re-search-forward "[\200-\377]" (marker-position endm) t) 738 (while (re-search-forward "[\200-\377]" (marker-position endm) t)
739 (setq i (1+ i)) 739 (setq i (1+ i))
740 (backward-char) 740 (backward-char)
741 (insert (format "\\%03o" (string-to-char (string-make-unibyte (buffer-substring (point) (1+ (point))))))) 741 (insert (format "\\%03o" (string-to-char
742 (buffer-substring (point) (1+ (point))))))
742 (delete-char 1)) 743 (delete-char 1))
743 (message "%d change%s made" i (if (= i 1) "" "s")) 744 (message "%d change%s made" i (if (= i 1) "" "s"))
744 (set-marker endm nil))))) 745 (set-marker endm nil)))))
diff --git a/test/lisp/progmodes/ps-mode-tests.el b/test/lisp/progmodes/ps-mode-tests.el
new file mode 100644
index 00000000000..aa0c4f3a059
--- /dev/null
+++ b/test/lisp/progmodes/ps-mode-tests.el
@@ -0,0 +1,37 @@
1;;; ps-mode-tests.el --- Test suite for ps-mode
2
3;; Copyright (C) 2019 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Commentary:
21
22;;; Code:
23
24(require 'ert)
25(require 'ps-mode)
26
27(ert-deftest ps-mode-test-octal-region ()
28 (with-temp-buffer
29 (set-buffer-multibyte nil)
30 (insert "foo" #x90 #x91 #x92 "bar")
31 (ps-mode-octal-region (point-min) (point-max))
32 (should (equal (buffer-string)
33 "foo\\220\\221\\222bar"))))
34
35(provide 'ps-mode-tests)
36
37;;; ps-mode-tests.el ends here