aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimen Heggestøyl2020-04-25 09:10:56 +0200
committerSimen Heggestøyl2020-04-25 09:12:24 +0200
commitbd0a8783a353d11467bf3f5272efd8a6de07b9e0 (patch)
tree66af696ccba3d5d05bd0fe6e94af91872ed39ef8
parente8493e32f8f447da4196cab668ba35a879259e68 (diff)
downloademacs-bd0a8783a353d11467bf3f5272efd8a6de07b9e0.tar.gz
emacs-bd0a8783a353d11467bf3f5272efd8a6de07b9e0.zip
Use lexical-binding in po.el and add tests
* lisp/textmodes/po.el: Use lexical-binding. * test/lisp/textmodes/po-tests.el: New file with tests for po.el.
-rw-r--r--lisp/textmodes/po.el2
-rw-r--r--test/lisp/textmodes/po-tests.el68
2 files changed, 69 insertions, 1 deletions
diff --git a/lisp/textmodes/po.el b/lisp/textmodes/po.el
index d5645e86304..29c6d3f4608 100644
--- a/lisp/textmodes/po.el
+++ b/lisp/textmodes/po.el
@@ -1,4 +1,4 @@
1;;; po.el --- basic support of PO translation files 1;;; po.el --- basic support of PO translation files -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1995-1998, 2000-2020 Free Software Foundation, Inc. 3;; Copyright (C) 1995-1998, 2000-2020 Free Software Foundation, Inc.
4 4
diff --git a/test/lisp/textmodes/po-tests.el b/test/lisp/textmodes/po-tests.el
new file mode 100644
index 00000000000..a098290ce15
--- /dev/null
+++ b/test/lisp/textmodes/po-tests.el
@@ -0,0 +1,68 @@
1;;; po-tests.el --- Tests for po.el -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2020 Free Software Foundation, Inc.
4
5;; Author: Simen Heggestøyl <simenheg@gmail.com>
6;; Keywords:
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22
23;;; Commentary:
24
25;;
26
27;;; Code:
28
29(require 'po)
30(require 'ert)
31
32(defconst po-tests--buffer-string
33 "# Norwegian bokmål translation of the GIMP.
34# Copyright (C) 1999-2001 Free Software Foundation, Inc.
35#
36msgid \"\"
37msgstr \"\"
38\"Project-Id-Version: gimp 2.8.5\\n\"
39\"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gimp/issues\\n\"
40\"POT-Creation-Date: 2013-05-27 14:57+0200\\n\"
41\"PO-Revision-Date: 2013-05-27 15:21+0200\\n\"
42\"Language: nb\\n\"
43\"MIME-Version: 1.0\\n\"
44\"Content-Type: text/plain; charset=UTF-8\\n\"
45\"Content-Transfer-Encoding: 8bit\\n\"
46\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"
47
48#: ../desktop/gimp.desktop.in.in.h:1 ../app/about.h:26
49msgid \"GNU Image Manipulation Program\"
50msgstr \"GNU bildebehandlingsprogram\"
51")
52
53(ert-deftest po-tests-find-charset ()
54 (with-temp-buffer
55 (insert po-tests--buffer-string)
56 (should (equal (po-find-charset (cons nil (current-buffer)))
57 "UTF-8"))))
58
59(ert-deftest po-tests-find-file-coding-system-guts ()
60 (with-temp-buffer
61 (insert po-tests--buffer-string)
62 (should (equal (po-find-file-coding-system-guts
63 'insert-file-contents
64 (cons "*tmp*" (current-buffer)))
65 '(utf-8 . nil)))))
66
67(provide 'po-tests)
68;;; po-tests.el ends here