summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog27
-rw-r--r--test/automated/Makefile.in3
-rw-r--r--test/automated/file-notify-tests.el47
-rw-r--r--test/automated/inotify-test.el4
-rw-r--r--test/automated/python-tests.el47
-rw-r--r--test/automated/subword-tests.el50
6 files changed, 159 insertions, 19 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index d3d8db6b501..bffe85e6a7a 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,30 @@
+2013-07-24 Michael Albinus <michael.albinus@gmx.de>
+
+ * automated/file-notify-tests.el
+ (file-notify--test-local-enabled): New defconst. Replaces all
+ `file-notify-support' occurences.
+ (file-notify--test-remote-enabled): New defun.
+ (file-notify--deftest-remote): Use it.
+ (file-notify-test00-availability): Rewrite.
+ (file-notify-test00-availability-remote): New defun.
+ (file-notify-test01-add-watch): Rewrite first erroneous check.
+
+2013-07-23 Glenn Morris <rgm@gnu.org>
+
+ * automated/inotify-test.el (inotify-file-watch-simple):
+ Delete temp-file when done.
+
+ * automated/subword-tests.el: Require subword.
+
+2013-07-22 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * automated/subword-tests.el: New file.
+
+2013-07-13 Fabián Ezequiel Gallina <fgallina@gnu.org>
+
+ * automated/python-tests.el (python-imenu-create-index-2)
+ (python-imenu-create-index-3): New tests.
+
2013-07-11 Glenn Morris <rgm@gnu.org>
* automated/ert-tests.el: Require cl-lib at runtime too.
diff --git a/test/automated/Makefile.in b/test/automated/Makefile.in
index 6e7111e589c..d4bfcc12130 100644
--- a/test/automated/Makefile.in
+++ b/test/automated/Makefile.in
@@ -1,4 +1,5 @@
-# Maintenance productions for the automated test directory
+### @configure_input@
+
# Copyright (C) 2010-2013 Free Software Foundation, Inc.
# This file is part of GNU Emacs.
diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el
index 0e9be33f157..8bd4f258b1c 100644
--- a/test/automated/file-notify-tests.el
+++ b/test/automated/file-notify-tests.el
@@ -47,13 +47,21 @@
tramp-message-show-message nil)
(when noninteractive (defalias 'tramp-read-passwd 'ignore))
+;; We do not want to try and fail `file-notify-add-watch'.
+(defconst file-notify--test-local-enabled file-notify--library
+ "Whether local file notification is enabled.")
+
+;; We need also a check on the remote side, w/o adding a file monitor.
+(defun file-notify--test-remote-enabled ()
+ "Whether remote file notification is enabled."
+ (ignore-errors
+ (and (file-remote-p file-notify-test-remote-temporary-file-directory)
+ (file-directory-p file-notify-test-remote-temporary-file-directory)
+ (file-writable-p file-notify-test-remote-temporary-file-directory))))
+
(defmacro file-notify--deftest-remote (test docstring)
"Define ert `TEST-remote' for remote files."
- `(when (ignore-errors
- (and
- (file-remote-p file-notify-test-remote-temporary-file-directory)
- (file-directory-p file-notify-test-remote-temporary-file-directory)
- (file-writable-p file-notify-test-remote-temporary-file-directory)))
+ `(when (and (file-notify--test-remote-enabled) (ert-get-test ',test))
;; Define the test.
(ert-deftest ,(intern (concat (symbol-name test) "-remote")) ()
,docstring
@@ -77,10 +85,16 @@
(ert-deftest file-notify-test00-availability ()
"Test availability of `file-notify'."
- :expected-result (if file-notify-support :passed :failed)
- (should (memq file-notify-support '(gfilenotify inotify w32notify))))
+ (let (desc)
+ ;; Check, that different valid parameters are accepted.
+ (should (setq desc (file-notify-add-watch
+ temporary-file-directory '(change) 'ignore)))
+ (file-notify-rm-watch desc)))
+
+(file-notify--deftest-remote file-notify-test00-availability
+ "Test availability of `file-notify' for remote files.")
-(when file-notify-support
+(when file-notify--test-local-enabled
(ert-deftest file-notify-test01-add-watch ()
"Check `file-notify-add-watch'."
@@ -99,9 +113,8 @@
(file-notify-rm-watch desc)
;; Check error handling.
- (should
- (equal (car (should-error (file-notify-add-watch 1 2 3 4)))
- 'wrong-number-of-arguments))
+ (should-error (file-notify-add-watch 1 2 3 4)
+ :type 'wrong-number-of-arguments)
(should
(equal (should-error (file-notify-add-watch 1 2 3))
'(wrong-type-argument 1)))
@@ -116,7 +129,7 @@
(file-notify--deftest-remote file-notify-test01-add-watch
"Check `file-notify-add-watch' for remote files.")
- ) ;; file-notify-support
+ ) ;; file-notify--test-local-enabled
(defun file-notify--test-event-test ()
"Ert test function to be called by `file-notify--test-event-handler'.
@@ -147,7 +160,7 @@ Save the result in `file-notify--test-results', for later analysis."
(expand-file-name
(make-temp-name "file-notify-test") temporary-file-directory))
-(when file-notify-support
+(when file-notify--test-local-enabled
(ert-deftest file-notify-test02-events ()
"Check file creation/removal notifications."
@@ -189,13 +202,13 @@ Save the result in `file-notify--test-results', for later analysis."
(file-notify--deftest-remote file-notify-test02-events
"Check file creation/removal notifications for remote files.")
- ) ;; file-notify-support
+ ) ;; file-notify--test-local-enabled
;; autorevert runs only in interactive mode.
(defvar auto-revert-remote-files)
(setq auto-revert-remote-files t)
(require 'autorevert)
-(when (and file-notify-support (null noninteractive))
+(when (and file-notify--test-local-enabled (null noninteractive))
(ert-deftest file-notify-test03-autorevert ()
"Check autorevert via file notification.
@@ -249,12 +262,12 @@ This test is skipped in batch mode."
(file-notify--deftest-remote file-notify-test03-autorevert
"Check autorevert via file notification for remote files.
This test is skipped in batch mode.")
- ) ;; (and file-notify-support (null noninteractive))
+ ) ;; (and file-notify--test-local-enabled (null noninteractive))
(defun file-notify-test-all (&optional interactive)
"Run all tests for \\[file-notify]."
(interactive "p")
- (when file-notify-support
+ (when file-notify--test-local-enabled
(if interactive
(ert-run-tests-interactively "^file-notify-")
(ert-run-tests-batch "^file-notify-"))))
diff --git a/test/automated/inotify-test.el b/test/automated/inotify-test.el
index b4d20cf4fb1..97d78dcb58e 100644
--- a/test/automated/inotify-test.el
+++ b/test/automated/inotify-test.el
@@ -56,8 +56,10 @@
(insert "Foo\n"))
(sit-for 5) ;; Hacky. Wait for 5s until events are processed
(should (> events 0)))
- (inotify-rm-watch wd)))))
+ (inotify-rm-watch wd)
+ (delete-file temp-file)))))
)
(provide 'inotify-tests)
+
;;; inotify-tests.el ends here.
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index 1dffe9544fe..fdae235ad38 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -1745,6 +1745,53 @@ class Baz(object):
(cons "c (def)" (copy-marker 626)))))
(python-imenu-create-index)))))
+(ert-deftest python-imenu-create-index-2 ()
+ (python-tests-with-temp-buffer
+ "
+class Foo(object):
+ def foo(self):
+ def foo1():
+ pass
+
+ def foobar(self):
+ pass
+"
+ (goto-char (point-max))
+ (should (equal
+ (list
+ (list
+ "Foo (class)"
+ (cons "*class definition*" (copy-marker 2))
+ (list
+ "foo (def)"
+ (cons "*function definition*" (copy-marker 21))
+ (cons "foo1 (def)" (copy-marker 40)))
+ (cons "foobar (def)" (copy-marker 78))))
+ (python-imenu-create-index)))))
+
+(ert-deftest python-imenu-create-index-3 ()
+ (python-tests-with-temp-buffer
+ "
+class Foo(object):
+ def foo(self):
+ def foo1():
+ pass
+ def foo2():
+ pass
+"
+ (goto-char (point-max))
+ (should (equal
+ (list
+ (list
+ "Foo (class)"
+ (cons "*class definition*" (copy-marker 2))
+ (list
+ "foo (def)"
+ (cons "*function definition*" (copy-marker 21))
+ (cons "foo1 (def)" (copy-marker 40))
+ (cons "foo2 (def)" (copy-marker 77)))))
+ (python-imenu-create-index)))))
+
(ert-deftest python-imenu-create-flat-index-1 ()
(python-tests-with-temp-buffer
"
diff --git a/test/automated/subword-tests.el b/test/automated/subword-tests.el
new file mode 100644
index 00000000000..2137cd7d908
--- /dev/null
+++ b/test/automated/subword-tests.el
@@ -0,0 +1,50 @@
+;;; subword-tests.el --- Testing the subword rules
+
+;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
+
+;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
+;; Keywords:
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'ert)
+(require 'subword)
+
+(defconst subword-tests-strings
+ '("ABC^" ;;Bug#13758
+ "ABC^ ABC^Foo^ ABC^-Foo^ toto^ ABC^"))
+
+(ert-deftest subword-tests ()
+ "Test the `subword-mode' rules."
+ (with-temp-buffer
+ (dolist (str subword-tests-strings)
+ (erase-buffer)
+ (insert str)
+ (goto-char (point-min))
+ (while (search-forward "^" nil t)
+ (replace-match ""))
+ (goto-char (point-min))
+ (while (not (eobp))
+ (subword-forward 1)
+ (insert "^"))
+ (should (equal (buffer-string) str)))))
+
+(provide 'subword-tests)
+;;; subword-tests.el ends here