From fab89a832e53242af58e0a54bfe16c4b47063413 Mon Sep 17 00:00:00 2001 From: Olof-Joachim Frahm Date: Thu, 15 Jan 2015 23:36:12 +0000 Subject: [PATCH] Add first simple test case. --- tests/inotify.lisp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/inotify.lisp b/tests/inotify.lisp index 9458654..585a166 100644 --- a/tests/inotify.lisp +++ b/tests/inotify.lisp @@ -29,3 +29,22 @@ (in-package #:cl-inotify-tests) (in-suite cl-inotify) + +;; note that for all of these tests other programs might interfere, so +;; they might fail for no apparent reason + +(def-test read-raw-event-from-stream.1 () + (let ((tmp (osicat-posix:mkdtemp + (concatenate 'string + (namestring osicat:*temporary-directory*) + "cl-inotify-XXXXXX")))) + (with-unregistered-inotify (inotify T (tmp :all-events)) + (ensure-directories-exist (concatenate 'string tmp "/foo/")) + (unwind-protect + (let ((available (event-available-p inotify))) + (is-true available "No event was read") + (when available + (let ((event (read-raw-event-from-stream (inotify-stream inotify)))) + (is-true event "No event was read") + (is (equal "foo" (inotify-event-name event)))))) + (osicat:delete-directory-and-files tmp))))) -- 1.7.10.4