1 ;;; inotify-tests.el --- Test suite for inotify. -*- lexical-binding: t -*-
3 ;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
5 ;; Author: RĂ¼diger Sonderfeld <ruediger@c-plusplus.de>
7 ;; Human-Keywords: internal
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28 (when (featurep 'inotify
)
30 ;; (ert-deftest filewatch-file-watch-aspects-check ()
31 ;; "Test whether `file-watch' properly checks the aspects."
32 ;; (let ((temp-file (make-temp-file "filewatch-aspects")))
33 ;; (should (stringp temp-file))
34 ;; (should-error (file-watch temp-file 'wrong nil)
36 ;; (should-error (file-watch temp-file '(modify t) nil)
38 ;; (should-error (file-watch temp-file '(modify all-modify) nil)
40 ;; (should-error (file-watch temp-file '(access wrong modify) nil)
43 (ert-deftest inotify-file-watch-simple
()
44 "Test if watching a normal file works."
45 (let ((temp-file (make-temp-file "inotify-simple"))
48 (inotify-add-watch temp-file t
(lambda (ev)
49 (setq events
(1+ events
))))))
52 (with-temp-file temp-file
54 (sit-for 5) ;; Hacky. Wait for 5s until events are processed
55 (should (> events
0)))
56 (inotify-rm-watch wd
)))))
59 (provide 'inotify-tests
)
60 ;;; inotify-tests.el ends here.