diff options
author | Arun Isaac | 2017-02-27 23:12:23 +0530 |
---|---|---|
committer | Arun Isaac | 2017-02-27 23:17:27 +0530 |
commit | 890aa7d772cec8b99fb7567c32b79150e451b803 (patch) | |
tree | f79cbd3573349f4f09e82d0ff2edbb6f640104c7 /tests/el-exiftool-tests.el | |
parent | 32acfa10bc267f11b20885c6375b69d59f315d55 (diff) | |
download | exiftool.el-890aa7d772cec8b99fb7567c32b79150e451b803.tar.gz exiftool.el-890aa7d772cec8b99fb7567c32b79150e451b803.tar.lz exiftool.el-890aa7d772cec8b99fb7567c32b79150e451b803.zip |
Rewrite tests with dynamic variable `el-exiftool-tests--tag-value'.
* tests/el-exiftool-tests.el (el-exiftool-tests--tag-value): New
dynamic variable.
(read-write-test, delete-test): Rewrite to reference data in `el-exiftool-tests--tag-value'.
(delete-test): New test.
Diffstat (limited to 'tests/el-exiftool-tests.el')
-rw-r--r-- | tests/el-exiftool-tests.el | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/tests/el-exiftool-tests.el b/tests/el-exiftool-tests.el index 7361829..6d7d01a 100644 --- a/tests/el-exiftool-tests.el +++ b/tests/el-exiftool-tests.el @@ -28,6 +28,11 @@ ;;; Code: +(defvar el-exiftool-tests--tag-value + '(("Marked" . "True") + ("Creator" . "foo") + ("Rights" . "bar"))) + (require 'el-exiftool) (require 'ert) @@ -41,19 +46,28 @@ (delete-file ,temp-file))) (ert-deftest read-write-test () - (with-temp-test-file "test1.png" temp-filename - (let ((tag-value-alist '(("Marked" . "True")))) - (apply 'el-exiftool-write temp-filename tag-value-alist) - (should (equal (el-exiftool-read temp-filename (caar tag-value-alist)) - tag-value-alist))))) + (with-temp-test-file "test1.png" temp-file + (apply 'el-exiftool-write temp-file el-exiftool-tests--tag-value) + (should (equal (apply 'el-exiftool-read temp-file (mapcar 'car el-exiftool-tests--tag-value)) + el-exiftool-tests--tag-value)))) (ert-deftest delete-test () (with-temp-test-file "test1.png" temp-file - (el-exiftool-write temp-file '("Marked" . "True")) - (el-exiftool-write temp-file '("Marked" . "")) - (should (equal (el-exiftool-read temp-file "Marked") - '(("Marked" . "")))))) + (el-exiftool-write temp-file (car el-exiftool-tests--tag-value)) + (let ((delete-pair + (cons (caar el-exiftool-tests--tag-value) ""))) + (el-exiftool-write temp-file delete-pair) + (should (equal (car (el-exiftool-read temp-file "Marked")) + delete-pair))))) +(ert-deftest copy-test () + (with-temp-test-file "test1.png" temp-1 + (with-temp-test-file "test2.jpg" temp-2 + (apply 'el-exiftool-write temp-1 el-exiftool-tests--tag-value) + (el-exiftool-copy temp-1 temp-2) + (let ((tags (mapcar 'car el-exiftool-tests--tag-value))) + (should (equal (apply 'el-exiftool-read temp-1 tags) + (apply 'el-exiftool-read temp-2 tags))))))) (provide 'el-exiftool-tests) |