diff options
| author | Lars Ingebrigtsen | 2022-02-05 08:50:05 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-02-05 08:50:05 +0100 |
| commit | 224aeb2877fffc894e9d1b31f7f44db0e55160c3 (patch) | |
| tree | fea0b93f7f78a04e5d1d099aaf7cdbd2dd37c8a1 /test | |
| parent | 89d419255b662e6e4e916ecc2afa733a788e9b1e (diff) | |
| download | emacs-224aeb2877fffc894e9d1b31f7f44db0e55160c3.tar.gz emacs-224aeb2877fffc894e9d1b31f7f44db0e55160c3.zip | |
Fix yank-media utf-16 detection
* lisp/yank-media.el (yank-media--utf-16-p): Factor out into its
own function for easier testing and fix the code.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/yank-media-tests.el | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/lisp/yank-media-tests.el b/test/lisp/yank-media-tests.el new file mode 100644 index 00000000000..4487ae150da --- /dev/null +++ b/test/lisp/yank-media-tests.el | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | ;;; yank-media-tests.el --- Tests for yank-media.el -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2022 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 | ;; | ||
| 23 | |||
| 24 | ;;; Code: | ||
| 25 | |||
| 26 | (require 'yank-media) | ||
| 27 | (require 'ert) | ||
| 28 | (require 'ert-x) | ||
| 29 | |||
| 30 | (ert-deftest test-utf-16 () | ||
| 31 | (should-not (yank-media--utf-16-p "f")) | ||
| 32 | (should-not (yank-media--utf-16-p "fo")) | ||
| 33 | (should-not (yank-media--utf-16-p "\000ofo")) | ||
| 34 | (should (eq (yank-media--utf-16-p "\000o\000o") 'utf-16-be)) | ||
| 35 | (should (eq (yank-media--utf-16-p "o\000o\000") 'utf-16-le)) | ||
| 36 | (should-not (yank-media--utf-16-p "o\000\000o"))) | ||
| 37 | |||
| 38 | ;;; yank-media-tests.el ends here | ||