aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNoam Postavsky2018-01-26 20:45:38 -0500
committerNoam Postavsky2018-01-26 20:45:38 -0500
commitf5357b1ca4ae90e7ad6d8321884319cfdf828508 (patch)
tree5706d28900dd4f7441bae1629242a2ca029d645b /test
parentc9a268552c8294bbca607da239528e6b89f8fb5b (diff)
parent463f96b4813fb77d88a7b0fa93f94aa08d71689f (diff)
downloademacs-f5357b1ca4ae90e7ad6d8321884319cfdf828508.tar.gz
emacs-f5357b1ca4ae90e7ad6d8321884319cfdf828508.zip
Merge from emacs-26
463f96b481 * doc/lispref/searching.texi: Document regexp repetition l... 08a6195571 ; test/README: Document TEST_LOAD_EL parameter. 7bbea90b1a * src/syntax.c (char-syntax): Warn about ignoring text pro... 50fcbb5f61 ; * src/process.c (Fprocess_contact): Fix docstring typo. 81ae9c8c05 Load mm-util as needed for url-file and url-data (Bug#30258) 5a1ee67ae1 Another minor copyedit in the manual's "Scroll Bars" 226a651e9e Minor fix in documentation of 'equal' b26786c8d9 * lisp/dired-x.el (dired-guess-shell-alist-user): Doc fix.... 5699a824f0 Minor rewording in Emacs manual's "Help Mode" node f35ff0156e Fixes for Emacs manual in frames.texi 6cd4e8dcc5 * doc/misc/cl.texi (Efficiency Concerns): Fix 2012-10-27 t... 1412cf3edd Fix a few issues with latest GTK scaling changes 59db8dca03 Use scaled coordinates when calling into GTK 2892f05792 Scale monitor dimensions obtained from GTK
Diffstat (limited to 'test')
-rw-r--r--test/README6
-rw-r--r--test/lisp/url/url-file-resources/file.txt1
-rw-r--r--test/lisp/url/url-file-tests.el50
-rw-r--r--test/lisp/url/url-misc-tests.el41
4 files changed, 98 insertions, 0 deletions
diff --git a/test/README b/test/README
index 7f4afb32bd3..1cd9db3bb88 100644
--- a/test/README
+++ b/test/README
@@ -44,6 +44,12 @@ If your test file contains the tests "test-foo", "test2-foo" and
44"test-foo-remote", and you want to run only the former two tests, you 44"test-foo-remote", and you want to run only the former two tests, you
45could use a selector regexp: "make <filename> SELECTOR='\"foo$$\"'". 45could use a selector regexp: "make <filename> SELECTOR='\"foo$$\"'".
46 46
47Note that although the test files are always compiled (unless they set
48no-byte-compile), the source files will be run by default, to give
49nicer backtraces. To run the compiled version of a test use
50
51 make TEST_LOAD_EL=no ...
52
47 53
48(Also, see etc/compilation.txt for compilation mode font lock tests.) 54(Also, see etc/compilation.txt for compilation mode font lock tests.)
49 55
diff --git a/test/lisp/url/url-file-resources/file.txt b/test/lisp/url/url-file-resources/file.txt
new file mode 100644
index 00000000000..b0b4e38e5fd
--- /dev/null
+++ b/test/lisp/url/url-file-resources/file.txt
@@ -0,0 +1 @@
Some file data
diff --git a/test/lisp/url/url-file-tests.el b/test/lisp/url/url-file-tests.el
new file mode 100644
index 00000000000..969bca7f8d0
--- /dev/null
+++ b/test/lisp/url/url-file-tests.el
@@ -0,0 +1,50 @@
1;;; url-file-tests.el --- Test suite for url-file. -*- lexical-binding: t -*-
2
3;; Copyright (C) 2018 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;;; Code:
23
24(require 'url-file)
25(require 'ert)
26
27(defconst url-file-tests-data-directory
28 (expand-file-name "lisp/url/url-file-resources"
29 (or (getenv "EMACS_TEST_DIRECTORY")
30 (expand-file-name "../../.."
31 (or load-file-name
32 buffer-file-name))))
33 "Directory for url-file test files.")
34
35(ert-deftest url-file ()
36 "Test reading file via file:// URL."
37 (let ((file (expand-file-name "file.txt" url-file-tests-data-directory)))
38 (should (equal
39 (with-current-buffer
40 (url-file (url-generic-parse-url (concat "file://" file))
41 #'ignore nil)
42 (prog1 (buffer-substring (point) (point-max))
43 (kill-buffer)))
44 (with-temp-buffer
45 (insert-file-contents-literally file)
46 (buffer-string))))))
47
48(provide 'url-file-tests)
49
50;;; url-file-tests.el ends here
diff --git a/test/lisp/url/url-misc-tests.el b/test/lisp/url/url-misc-tests.el
new file mode 100644
index 00000000000..fec2609bb7f
--- /dev/null
+++ b/test/lisp/url/url-misc-tests.el
@@ -0,0 +1,41 @@
1;;; url-misc-tests.el --- Test suite for url-misc. -*- lexical-binding: t -*-
2
3;; Copyright (C) 2018 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;;; Code:
23
24(require 'url-misc)
25(require 'ert)
26
27(ert-deftest url-misc-data ()
28 "Test reading data: URL."
29 (should (equal
30 (with-current-buffer
31 (url-data (url-generic-parse-url "data:;,some%20text"))
32 (goto-char (point-min))
33 (forward-paragraph)
34 (forward-line)
35 (prog1 (buffer-substring (point) (point-max))
36 (kill-buffer)))
37 "some text")))
38
39(provide 'url-misc-tests)
40
41;;; url-misc-tests.el ends here