summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorArun Isaac2019-02-04 01:28:34 +0530
committerArun Isaac2019-02-04 01:35:10 +0530
commit8892e1485d2157e0e9be8f337d1d2ff7b1a6c338 (patch)
treec085804c75afe5365d9adb1c09301eac25717bbf /tests
parent3a07dbcb975577734d4abf6d68e1ab83a01951bb (diff)
downloadexiftool.el-8892e1485d2157e0e9be8f337d1d2ff7b1a6c338.tar.gz
exiftool.el-8892e1485d2157e0e9be8f337d1d2ff7b1a6c338.tar.lz
exiftool.el-8892e1485d2157e0e9be8f337d1d2ff7b1a6c338.zip
Signal a file-missing error when file is not found.
* exiftool.el (exiftool--assert-file-exists): New function.
(exiftool-read, exiftool-copy, exiftool-write): Assert that file
arguments exist before operating on them.
* tests/exiftool-tests.el (read-file-not-found-test,
copy-file-not-found-test, write-file-not-found-test): New tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/exiftool-tests.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/exiftool-tests.el b/tests/exiftool-tests.el
index 8d040c4..0ef5fa2 100644
--- a/tests/exiftool-tests.el
+++ b/tests/exiftool-tests.el
@@ -1,7 +1,7 @@
 ;;; exiftool.el --- Elisp wrapper around exiftool ;; -*- lexical-binding: t -*-
 
 ;; Elisp wrapper around exiftool
-;; Copyright (C) 2017 by Arun I
+;; Copyright (C) 2017, 2019 by Arun I
 ;;
 ;; Author: Arun I <arunisaac@systemreboot.net>
 ;; Keywords: data
@@ -90,6 +90,19 @@
 		     (equal (apply 'exiftool-read temp-1 some-tags)
 			    (apply 'exiftool-read temp-2 some-tags))))))))
 
+(ert-deftest read-file-not-found-test ()
+  (should-error (exiftool-read "non-existent-file.png")
+                :type 'file-missing))
+
+(ert-deftest copy-file-not-found-test ()
+  (should-error (exiftool-copy "non-existent-file-1.png"
+                               "non-existent-file-2.png")
+                :type 'file-missing))
+
+(ert-deftest write-file-not-found-test ()
+  (should-error (exiftool-write "non-existent-file.png")
+                :type 'file-missing))
+
 (provide 'exiftool-tests)
 
 ;;; exiftool-tests.el ends here