unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
blob 31a28293fa3b73b4c60dde60f506f506ab34b30f 2802 bytes (raw)
name: test/lisp/image/gravatar-tests.el 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
;;; gravatar-tests.el --- tests for gravatar.el -*- lexical-binding: t -*-

;; Copyright (C) 2019-2020 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 'gravatar)

(ert-deftest gravatar-hash ()
  "Test `gravatar-hash'."
  (should (equal (gravatar-hash "") "d41d8cd98f00b204e9800998ecf8427e"))
  (let ((hash "acbd18db4cc2f85cedef654fccc4a4d8"))
    (should (equal (gravatar-hash "foo") hash))
    (should (equal (gravatar-hash "foo ") hash))
    (should (equal (gravatar-hash " foo") hash))
    (should (equal (gravatar-hash " foo ") hash))))

(ert-deftest gravatar-size ()
  "Test query strings for `gravatar-size'."
  (let ((gravatar-default-image nil)
        (gravatar-force-default nil))
    (let ((gravatar-size 2048))
      (should (equal (gravatar--query-string) "r=g&s=2048")))
    (let ((gravatar-size nil))
      (should (equal (gravatar--query-string) "r=g")))))

(ert-deftest gravatar-default-image ()
  "Test query strings for `gravatar-default-image'."
  (let ((gravatar-force-default nil)
        (gravatar-size nil))
    (let ((gravatar-default-image nil))
      (should (equal (gravatar--query-string) "r=g")))
    (let ((gravatar-default-image "404"))
      (should (equal (gravatar--query-string) "r=g&d=404")))
    (let ((gravatar-default-image "https://foo/bar.png"))
      (should (equal (gravatar--query-string)
                     "r=g&d=https%3A%2F%2Ffoo%2Fbar.png")))))

(ert-deftest gravatar-force-default ()
  "Test query strings for `gravatar-force-default'."
  (let ((gravatar-default-image nil)
        (gravatar-size nil))
    (let ((gravatar-force-default nil))
      (should (equal (gravatar--query-string) "r=g")))
    (let ((gravatar-force-default t))
      (should (equal (gravatar--query-string) "r=g&f=y")))))

(ert-deftest gravatar-build-url ()
  "Test `gravatar-build-url'."
  (let ((gravatar-default-image nil)
        (gravatar-force-default nil)
        (gravatar-service 'gravatar)
        (gravatar-size nil))
    (should (equal (gravatar-build-url "foo") "\
https://www.gravatar.com/avatar/acbd18db4cc2f85cedef654fccc4a4d8?r=g"))))

;;; gravatar-tests.el ends here

debug log:

solving 31a28293fa ...
found 31a28293fa in https://yhetil.org/emacs-bugs/20200307001141.10771-1-philip@warpmail.net/ ||
	https://yhetil.org/emacs-bugs/ykgnh7yxpnrb.fsf@fau.de/
found e66b5c6803 in https://git.savannah.gnu.org/cgit/emacs.git
preparing index
index prepared:
100644 e66b5c6803d8e87b64dd8ff03103cf98f157cf42	test/lisp/image/gravatar-tests.el

applying [1/1] https://yhetil.org/emacs-bugs/20200307001141.10771-1-philip@warpmail.net/
diff --git a/test/lisp/image/gravatar-tests.el b/test/lisp/image/gravatar-tests.el
index e66b5c6803..31a28293fa 100644

Checking patch test/lisp/image/gravatar-tests.el...
Applied patch test/lisp/image/gravatar-tests.el cleanly.

skipping https://yhetil.org/emacs-bugs/ykgnh7yxpnrb.fsf@fau.de/ for 31a28293fa
index at:
100644 31a28293fa3b73b4c60dde60f506f506ab34b30f	test/lisp/image/gravatar-tests.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).