summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPhilip Kaludercic <philipk@posteo.net>2022-10-15 17:38:30 +0200
committerPhilip Kaludercic <philipk@posteo.net>2022-10-15 17:38:30 +0200
commit01e45efcd44e92dd259283df0e62653c7c20e9cc (patch)
tree552c1a6ce7d52b897cf5f089d6c589921efbe9bd /test
parent982c0e6c15535defcf6ac3c4d4169708c60efc18 (diff)
parent5933055a3e7387b0095f0df7876a208ab15f4f45 (diff)
downloademacs-01e45efcd44e92dd259283df0e62653c7c20e9cc.tar.gz
emacs-01e45efcd44e92dd259283df0e62653c7c20e9cc.tar.bz2
emacs-01e45efcd44e92dd259283df0e62653c7c20e9cc.zip
Merge branch 'master' into feature/package+vc
Diffstat (limited to 'test')
-rw-r--r--test/lisp/calendar/icalendar-tests.el2
-rw-r--r--test/lisp/cedet/semantic-utest.el1
-rw-r--r--test/lisp/dnd-tests.el2
-rw-r--r--test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tarbin0 -> 10240 bytes
-rw-r--r--test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tarbin0 -> 10240 bytes
-rw-r--r--test/lisp/emacs-lisp/package-tests.el24
-rw-r--r--test/lisp/net/puny-resources/IdnaTestV2.txt4
-rw-r--r--test/lisp/progmodes/python-tests.el126
-rw-r--r--test/lisp/progmodes/ruby-mode-resources/ruby.rb4
-rw-r--r--test/lisp/time-stamp-tests.el8
-rw-r--r--test/manual/image-circular-tests.el41
-rw-r--r--test/src/fns-tests.el2
-rw-r--r--test/src/lcms-tests.el2
-rw-r--r--test/src/sqlite-tests.el13
14 files changed, 198 insertions, 31 deletions
diff --git a/test/lisp/calendar/icalendar-tests.el b/test/lisp/calendar/icalendar-tests.el
index 7f8cd479146..2e9353a09b8 100644
--- a/test/lisp/calendar/icalendar-tests.el
+++ b/test/lisp/calendar/icalendar-tests.el
@@ -1310,7 +1310,7 @@ SUMMARY:and diary-anniversary
"import-real-world-2003-05-29.diary-european"
"import-real-world-2003-05-29.diary-american")
- ;; created with http://apps.marudot.com/ical/
+ ;; created with https://apps.marudot.com/ical/
(icalendar-tests--test-import "import-real-world-no-dst.ics"
nil
"import-real-world-no-dst.diary-european"
diff --git a/test/lisp/cedet/semantic-utest.el b/test/lisp/cedet/semantic-utest.el
index 24a467474b9..b577b198089 100644
--- a/test/lisp/cedet/semantic-utest.el
+++ b/test/lisp/cedet/semantic-utest.el
@@ -609,7 +609,6 @@ INSERTME is the text to be inserted after the deletion."
(semantic-utest-generic (semantic-utest-fname "phptest.php") semantic-utest-PHP-buffer-contents semantic-utest-PHP-name-contents '("fun1") "fun2" "%^@")
)
-;look at http://mfgames.com/linux/csharp-mode
(ert-deftest semantic-utest-Csharp() ;; hmm i don't even know how to edit a scharp file. need a csharp mode implementation i suppose
(skip-unless (featurep 'csharp-mode))
(semantic-utest-generic (semantic-utest-fname "csharptest.cs") semantic-utest-Csharp-buffer-contents semantic-utest-Csharp-name-contents '("fun2") "//1" "//deleted line")
diff --git a/test/lisp/dnd-tests.el b/test/lisp/dnd-tests.el
index 67b660fc124..bdadc0f2801 100644
--- a/test/lisp/dnd-tests.el
+++ b/test/lisp/dnd-tests.el
@@ -416,7 +416,7 @@ This function only tries to handle strings."
;; system specific test is in x-dnd-tests.el. When running this
;; interactively, keep in mind that there are only two file managers
;; which are known to implement XDS correctly: System G (see
- ;; http://nps-systemg.sourceforge.net), and Emacs itself. GTK file
+ ;; https://nps-systemg.sourceforge.net), and Emacs itself. GTK file
;; managers such as Nautilus will not work, since they prefer the
;; `text/uri-list' selection target to `XdndDirectSave0', contrary
;; to the XDS specification.
diff --git a/test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar b/test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar
new file mode 100644
index 00000000000..009c4fc420c
--- /dev/null
+++ b/test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar
Binary files differ
diff --git a/test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar b/test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar
new file mode 100644
index 00000000000..16c79e529f4
--- /dev/null
+++ b/test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar
Binary files differ
diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el
index b903cd781ba..ffe4d7cd5fd 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -275,11 +275,31 @@ Must called from within a `tar-mode' buffer."
(let* ((pkg-el "multi-file-0.2.3.tar")
(source-file (expand-file-name pkg-el (ert-resource-directory))))
- (package-initialize)
(should-not (package-installed-p 'multie-file))
(package-install-file source-file)
(should (package-installed-p 'multi-file))
- (package-delete (cadr (assq 'multi-file package-alist))))
+ (package-delete (cadr (assq 'multi-file package-alist))))))
+
+(ert-deftest package-test-bug58367 ()
+ "Check variations in tarball formats."
+ (with-package-test (:basedir (ert-resource-directory))
+ (package-initialize)
+
+ ;; A package whose first entry is the main dir but without trailing /.
+ (let* ((pkg-el "ustar-withsub-0.1.tar")
+ (source-file (expand-file-name pkg-el (ert-resource-directory))))
+ (should-not (package-installed-p 'ustar-withsub))
+ (package-install-file source-file)
+ (should (package-installed-p 'ustar-withsub))
+ (package-delete (cadr (assq 'ustar-withsub package-alist))))
+
+ ;; A package whose first entry is a file in a subdir.
+ (let* ((pkg-el "v7-withsub-0.1.tar")
+ (source-file (expand-file-name pkg-el (ert-resource-directory))))
+ (should-not (package-installed-p 'v7-withsub))
+ (package-install-file source-file)
+ (should (package-installed-p 'v7-withsub))
+ (package-delete (cadr (assq 'v7-withsub package-alist))))
))
(ert-deftest package-test-install-file-EOLs ()
diff --git a/test/lisp/net/puny-resources/IdnaTestV2.txt b/test/lisp/net/puny-resources/IdnaTestV2.txt
index ed2f32e129f..4b8d5984a7c 100644
--- a/test/lisp/net/puny-resources/IdnaTestV2.txt
+++ b/test/lisp/net/puny-resources/IdnaTestV2.txt
@@ -2,12 +2,12 @@
# Date: 2021-08-17, 19:34:01 GMT
# © 2021 Unicode®, Inc.
# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
-# For terms of use, see http://www.unicode.org/terms_of_use.html
+# For terms of use, see https://www.unicode.org/terms_of_use.html
#
# Unicode IDNA Compatible Preprocessing for UTS #46
# Version: 14.0.0
#
-# For documentation and usage, see http://www.unicode.org/reports/tr46
+# For documentation and usage, see https://www.unicode.org/reports/tr46
#
# Test cases for verifying UTS #46 conformance.
#
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index fdaedb5fd7a..9ad2d169308 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -43,6 +43,37 @@ always located at the beginning of buffer."
(goto-char (point-min))
,@body)))
+(defun python-tests-shell-wait-for-prompt ()
+ "Wait for the prompt in the shell buffer."
+ (python-shell-with-shell-buffer
+ (while (not (if-let ((prompt (python-util-comint-last-prompt)))
+ (python-shell-comint-end-of-output-p
+ (buffer-substring-no-properties
+ (car prompt) (cdr prompt)))))
+ (sit-for 0.1))))
+
+(defmacro python-tests-with-temp-buffer-with-shell (contents &rest body)
+ "Create a `python-mode' enabled temp buffer with CONTENTS and `run-python'.
+BODY is code to be executed within the temp buffer. Point is
+always located at the beginning of buffer. Native completion is
+turned off. Shell buffer will be killed on exit."
+ (declare (indent 1) (debug t))
+ `(with-temp-buffer
+ (let ((python-indent-guess-indent-offset nil)
+ (python-shell-completion-native-enable nil))
+ (python-mode)
+ (unwind-protect
+ (progn
+ (run-python nil t)
+ (insert ,contents)
+ (goto-char (point-min))
+ (python-tests-shell-wait-for-prompt)
+ ,@body)
+ (when (python-shell-get-buffer)
+ (python-shell-with-shell-buffer
+ (let (kill-buffer-hook kill-buffer-query-functions)
+ (kill-buffer))))))))
+
(defmacro python-tests-with-temp-file (contents &rest body)
"Create a `python-mode' enabled file with CONTENTS.
BODY is code to be executed within the temp buffer. Point is
@@ -4365,6 +4396,101 @@ def foo():
(python-shell-interpreter "/some/path/to/bin/pypy"))
(should (python-shell-completion-native-interpreter-disabled-p))))
+(ert-deftest python-shell-completion-1 ()
+ (skip-unless (executable-find python-tests-shell-interpreter))
+ (python-tests-with-temp-buffer-with-shell
+ "
+import abc
+"
+ (let ((inhibit-message t))
+ (python-shell-send-buffer)
+ (python-tests-shell-wait-for-prompt)
+ (goto-char (point-max))
+ (insert "abc.")
+ (should (completion-at-point))
+ (insert "A")
+ (should (completion-at-point)))))
+
+(ert-deftest python-shell-completion-2 ()
+ "Should work regardless of the point in the Shell buffer."
+ (skip-unless (executable-find python-tests-shell-interpreter))
+ (python-tests-with-temp-buffer-with-shell
+ "
+import abc
+"
+ (let ((inhibit-message t))
+ (python-shell-send-buffer)
+ (python-tests-shell-wait-for-prompt)
+ (python-shell-with-shell-buffer
+ (goto-char (point-min)))
+ (goto-char (point-max))
+ (insert "abc.")
+ (should (completion-at-point)))))
+
+(ert-deftest python-shell-completion-native-1 ()
+ (skip-unless (executable-find python-tests-shell-interpreter))
+ (python-tests-with-temp-buffer-with-shell
+ "
+import abc
+"
+ (let ((inhibit-message t))
+ (python-shell-completion-native-turn-on)
+ (python-shell-send-buffer)
+ (python-tests-shell-wait-for-prompt)
+ (goto-char (point-max))
+ (insert "abc.")
+ (should (completion-at-point))
+ (insert "A")
+ (should (completion-at-point)))))
+
+(ert-deftest python-shell-completion-native-2 ()
+ "Should work regardless of the point in the Shell buffer."
+ (skip-unless (executable-find python-tests-shell-interpreter))
+ (python-tests-with-temp-buffer-with-shell
+ "
+import abc
+"
+ (let ((inhibit-message t))
+ (python-shell-completion-native-turn-on)
+ (python-shell-send-buffer)
+ (python-tests-shell-wait-for-prompt)
+ (python-shell-with-shell-buffer
+ (goto-char (point-min)))
+ (goto-char (point-max))
+ (insert "abc.")
+ (should (completion-at-point)))))
+
+(ert-deftest python-shell-completion-native-with-ffap-1 ()
+ (skip-unless (executable-find python-tests-shell-interpreter))
+ (python-tests-with-temp-buffer-with-shell
+ "
+import abc
+"
+ (let ((inhibit-message t))
+ (python-shell-completion-native-turn-on)
+ (python-shell-send-buffer)
+ (python-tests-shell-wait-for-prompt)
+ (goto-char (point-max))
+ (insert "abc.")
+ ;; This is called when FFAP is enabled and a find-file function is called.
+ (python-ffap-module-path "abc.")
+ (should (completion-at-point)))))
+
+(ert-deftest python-shell-completion-native-with-eldoc-1 ()
+ (skip-unless (executable-find python-tests-shell-interpreter))
+ (python-tests-with-temp-buffer-with-shell
+ "
+import abc
+"
+ (let ((inhibit-message t))
+ (python-shell-completion-native-turn-on)
+ (python-shell-send-buffer)
+ (python-tests-shell-wait-for-prompt)
+ (goto-char (point-max))
+ (insert "abc.")
+ ;; This is called by idle-timer when ElDoc is enabled.
+ (python-eldoc-function)
+ (should (completion-at-point)))))
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
index 0c206b1e0c2..f39489071ec 100644
--- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb
+++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb
@@ -177,11 +177,11 @@ qux :+,
b = $:
c = ??
-# Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html
+# Example from https://ruby-doc.com/docs/ProgrammingRuby/
d = 4 + 5 + # no '\' needed
6 + 7
-# Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html
+# Example from https://www.ruby-doc.org/docs/ProgrammingRuby/
e = 8 + 9 \
+ 10 # '\' needed
diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el
index 55e37b71d80..1b5ef04436d 100644
--- a/test/lisp/time-stamp-tests.el
+++ b/test/lisp/time-stamp-tests.el
@@ -89,11 +89,11 @@
(iter-defun time-stamp-test-pattern-sequential ()
"Iterate through each possibility for a part of `time-stamp-pattern'."
(let ((pattern-value-parts
- '(("4/" "10/" "-4/" "0/" "") ;0: line limit
+ '(("4/" "10/" "-9/" "0/" "") ;0: line limit
("stamp<" "") ;1: start
- ("%-d" "%_H" "%^a" "%#Z" "%:A" "%02H" "%%" "") ;2: format part 1
+ ("%-d" "%_H" "%^a" "%#Z" "%:A" "%09z" "%%" "") ;2: format part 1
(" " "x" ":" "\n" "") ;3: format part 2
- ("%-d" "%_H" "%^a" "%#Z" "%:A" "%02H" "%%") ;4: format part 3
+ ("%-d" "%_H" "%^a" "%#Z" "%:A" "%09z" "%%") ;4: format part 3
(">end" "")))) ;5: end
(dotimes (cur (length pattern-value-parts))
(dotimes (cur-index (length (nth cur pattern-value-parts)))
@@ -118,7 +118,7 @@
(iter-defun time-stamp-test-pattern-multiply ()
"Iterate through every combination of parts of `time-stamp-pattern'."
(let ((line-limit-values '("" "4/"))
- (start-values '("" "stamp<"))
+ (start-values '("" "/stamp/"))
(format-values '("%%" "%m"))
(end-values '("" ">end")))
;; yield all combinations of the above
diff --git a/test/manual/image-circular-tests.el b/test/manual/image-circular-tests.el
index 1299970f827..d2187cbbadc 100644
--- a/test/manual/image-circular-tests.el
+++ b/test/manual/image-circular-tests.el
@@ -27,8 +27,11 @@
(require 'ert)
+(declare-function image-size "image.c" (spec &optional pixels frame))
+
(ert-deftest image-test-duplicate-keywords ()
"Test that duplicate keywords in an image spec lead to rejection."
+ (skip-unless (display-images-p))
(should-error (image-size `(image :type xbm :type xbm
:data-width 1 :data-height 1
:data ,(bool-vector t))
@@ -36,33 +39,37 @@
(ert-deftest image-test-circular-plist ()
"Test that a circular image spec is rejected."
- (should-error
- (let ((l `(image :type xbm :data-width 1 :data-height 1
- :data ,(bool-vector t))))
- (setcdr (last l) '#1=(:invalid . #1#))
- (image-size l t))))
+ (skip-unless (display-images-p))
+ (let ((spec `(image :type xbm :data-width 1 :data-height 1
+ :data ,(bool-vector t)
+ . ,'#1=(:invalid . #1#))))
+ (should-error (image-size spec t))))
(ert-deftest image-test-:type-property-value ()
"Test that :type is allowed as a property value in an image spec."
+ (skip-unless (display-images-p))
(should (equal (image-size `(image :dummy :type :type xbm
:data-width 1 :data-height 1
:data ,(bool-vector t))
t)
- (cons 1 1))))
+ '(1 . 1))))
(ert-deftest image-test-circular-specs ()
- "Test that circular image spec property values do not cause infinite recursion."
- (should
- (let* ((circ1 (cons :dummy nil))
- (circ2 (cons :dummy nil))
- (spec1 `(image :type xbm :data-width 1 :data-height 1
- :data ,(bool-vector 1) :ignored ,circ1))
- (spec2 `(image :type xbm :data-width 1 :data-height 1
+ "Test with circular image spec property values.
+In particular, test that they do not cause infinite recursion."
+ :expected-result :failed ;; FIXME: bug#36403#63.
+ (skip-unless (display-images-p))
+ ;; Two copies needed to warm up image cache.
+ (let* ((circ1 (list :dummy))
+ (circ2 (list :dummy))
+ (spec1 `(image :type xbm :data-width 1 :data-height 1
+ :data ,(bool-vector 1) :ignored ,circ1))
+ (spec2 `(image :type xbm :data-width 1 :data-height 1
:data ,(bool-vector 1) :ignored ,circ2)))
- (setcdr circ1 circ1)
- (setcdr circ2 circ2)
- (and (equal (image-size spec1 t) (cons 1 1))
- (equal (image-size spec2 t) (cons 1 1))))))
+ (setcdr circ1 circ1)
+ (setcdr circ2 circ2)
+ (should (equal (image-size spec1 t) '(1 . 1)))
+ (should (equal (image-size spec2 t) '(1 . 1)))))
(provide 'image-circular-tests)
;;; image-circular-tests.el ends here.
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index 9a2bd5cef34..5d5d497c997 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -152,6 +152,8 @@
(,(string-to-multibyte "abc") < "abd")
(,(string-to-multibyte "abc") < ,(string-to-multibyte "abd"))
(,(string-to-multibyte "\x80") = ,(string-to-multibyte "\x80"))
+ ("Liberté, Égalité, Fraternité" = "Liberté, Égalité, Fraternité")
+ ("Liberté, Égalité, Fraternité" < "Liberté, Égalité, Sororité")
;; Cases concerning the ordering of raw bytes: these are
;; troublesome because the current `string<' order is not very useful as
diff --git a/test/src/lcms-tests.el b/test/src/lcms-tests.el
index 1829a7ea1f1..7f0f660d13e 100644
--- a/test/src/lcms-tests.el
+++ b/test/src/lcms-tests.el
@@ -28,7 +28,7 @@
;; https://github.com/njsmith/colorspacious
;; Other references:
-;; http://www.babelcolor.com/index_htm_files/A%20review%20of%20RGB%20color%20spaces.pdf
+;; https://www.babelcolor.com/index_htm_files/A%20review%20of%20RGB%20color%20spaces.pdf
;;; Code:
diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el
index 5af43923012..be4f60ab57f 100644
--- a/test/src/sqlite-tests.el
+++ b/test/src/sqlite-tests.el
@@ -241,4 +241,17 @@
(should (multibyte-string-p c1))
(should-not (multibyte-string-p c2)))))))
+(ert-deftest sqlite-returning ()
+ (skip-unless (sqlite-available-p))
+ (let (db)
+ (progn
+ (setq db (sqlite-open))
+ (sqlite-execute db "CREATE TABLE people1 (people_id INTEGER PRIMARY KEY, first TEXT, last TEXT)")
+ (should (null (sqlite-select db "select * from people1")))
+ (should
+ (equal
+ (sqlite-execute db "INSERT INTO people1 (first, last) values (?, ?) RETURNING people_id, first"
+ '("Joe" "Doe"))
+ '((1 "Joe")))))))
+
;;; sqlite-tests.el ends here