summaryrefslogtreecommitdiff
path: root/test/lisp/mh-e/mh-xface-tests.el
diff options
context:
space:
mode:
authorStephen Gildea <stepheng+emacs@gildea.com>2021-08-21 17:25:46 -0700
committerStephen Gildea <stepheng+emacs@gildea.com>2021-08-21 17:25:46 -0700
commitaa27c42cf910391d87396ffed3d2835417471b46 (patch)
tree66972efc3b963d1de5d725aa764af1c9a3c285cb /test/lisp/mh-e/mh-xface-tests.el
parent5f1ee1f8e6d5c7fe3a189676ed6e4bc07af718b0 (diff)
downloademacs-aa27c42cf910391d87396ffed3d2835417471b46.tar.gz
emacs-aa27c42cf910391d87396ffed3d2835417471b46.tar.bz2
emacs-aa27c42cf910391d87396ffed3d2835417471b46.zip
mh-x-image-url-sane-p: accept "https" URLs
* lisp/mh-e/mh-xface.el (mh-x-image-url-sane-p): Accept https URLs. * test/lisp/mh-e/mh-xface.el: New file, to test mh-x-image-url-sane-p.
Diffstat (limited to 'test/lisp/mh-e/mh-xface-tests.el')
-rw-r--r--test/lisp/mh-e/mh-xface-tests.el35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/lisp/mh-e/mh-xface-tests.el b/test/lisp/mh-e/mh-xface-tests.el
new file mode 100644
index 00000000000..65e3c82ec0b
--- /dev/null
+++ b/test/lisp/mh-e/mh-xface-tests.el
@@ -0,0 +1,35 @@
+;;; mh-xface-tests.el --- tests for mh-xface.el -*- lexical-binding: t -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; 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/>.
+
+;;; Code:
+
+(require 'ert)
+(require 'mh-xface)
+
+(ert-deftest mh-x-image-url-sane-p ()
+ "Test that `mh-x-image-url-sane-p' accepts a URL exactly if it is sane."
+ (should (equal (mh-x-image-url-sane-p (concat "http://"
+ (make-string 101 ?a)))
+ nil)) ;too long
+ (should (equal (mh-x-image-url-sane-p "http") nil)) ;too short
+ (should (equal (mh-x-image-url-sane-p "http:") t))
+ (should (equal (mh-x-image-url-sane-p "https") nil)) ;too short
+ (should (equal (mh-x-image-url-sane-p "https:") t))
+ (should (equal (mh-x-image-url-sane-p "https://www.example.com/me.png") t))
+ (should (equal (mh-x-image-url-sane-p "abcde:") nil)))