blob: a3fba3c490f21656dd9f4bd67a9fdcb18d30f2b6 (
plain)
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
|
;;; test-elfeed-config--decode-html-entities.el --- Tests for cj/--decode-html-entities -*- lexical-binding: t; -*-
;;; Commentary:
;; cj/--decode-html-entities replaces the six inline replace-regexp-in-string
;; calls that cj/youtube-to-elfeed-feed-format used to hand-decode an og:title.
;;; Code:
(require 'ert)
(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
(require 'elfeed-config)
(ert-deftest test-elfeed-decode-html-entities-all ()
"Normal: every supported entity is decoded."
(should (equal (cj/--decode-html-entities
"a & b <c> "d" 'e'")
"a & b <c> \"d\" 'e'")))
(ert-deftest test-elfeed-decode-html-entities-no-entities ()
"Boundary: text without entities is unchanged."
(should (equal (cj/--decode-html-entities "plain title") "plain title"))
(should (equal (cj/--decode-html-entities "") "")))
(ert-deftest test-elfeed-decode-html-entities-amp-first ()
"Boundary: & is decoded before the others (no double-decoding chains)."
(should (equal (cj/--decode-html-entities "Tom & Jerry <3")
"Tom & Jerry <3")))
(provide 'test-elfeed-config--decode-html-entities)
;;; test-elfeed-config--decode-html-entities.el ends here
|