summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2017-06-16 19:18:37 +0530
committerArun Isaac2017-06-16 19:18:37 +0530
commit5c86f81adca3b7e2256ade3af09bbddc53a26c4d (patch)
tree024fcc0e6f8d484f53962cdb6e5289479a58a58e
parentaafe5394c7be86047700f253743e395a0ce37764 (diff)
downloadexiftool.el-5c86f81adca3b7e2256ade3af09bbddc53a26c4d.tar.gz
exiftool.el-5c86f81adca3b7e2256ade3af09bbddc53a26c4d.tar.lz
exiftool.el-5c86f81adca3b7e2256ade3af09bbddc53a26c4d.zip
Deduplicate extraction of tags of test cases.
* tests/exiftool-tests.el (exiftool-tests--tags): New variable.
(read-write-test, copy-all-test, copy-some-test): Reference
exiftool-tests--tags.
-rw-r--r--tests/exiftool-tests.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/exiftool-tests.el b/tests/exiftool-tests.el
index ecb4f15..6f14ffe 100644
--- a/tests/exiftool-tests.el
+++ b/tests/exiftool-tests.el
@@ -37,6 +37,12 @@
     ("Subject" . "foo:bar")
     ("Description" . "foo: bar")))
 
+(defvar exiftool-tests--tags
+  (mapcar (cl-function
+	    (lambda ((tag . value))
+	      tag))
+	  exiftool-tests--tag-value))
+
 (require 'exiftool)
 (require 'cl-lib)
 (require 'ert)
@@ -53,7 +59,7 @@
 (ert-deftest read-write-test ()
   (with-temp-test-file "test1.png" temp-file
     (apply 'exiftool-write temp-file exiftool-tests--tag-value)
-    (should (equal (apply 'exiftool-read temp-file (mapcar 'car exiftool-tests--tag-value))
+    (should (equal (apply 'exiftool-read temp-file exiftool-tests--tags)
 		   exiftool-tests--tag-value))))
 
 (ert-deftest delete-test ()
@@ -70,19 +76,17 @@
     (with-temp-test-file "test2.png" temp-2
       (apply 'exiftool-write temp-1 exiftool-tests--tag-value)
       (exiftool-copy temp-1 temp-2)
-      (let ((tags (mapcar 'car exiftool-tests--tag-value)))
-	(should (equal (apply 'exiftool-read temp-1 tags)
-		       (apply 'exiftool-read temp-2 tags)))))))
+      (should (equal (apply 'exiftool-read temp-1 exiftool-tests--tags)
+		     (apply 'exiftool-read temp-2 exiftool-tests--tags))))))
 
 (ert-deftest copy-some-test ()
   (with-temp-test-file "test1.png" temp-1
     (with-temp-test-file "test2.png" temp-2
       (apply 'exiftool-write temp-1 exiftool-tests--tag-value)
-      (let* ((all-tags (mapcar 'car exiftool-tests--tag-value))
-	     (some-tags (cl-subseq all-tags 2)))
+      (let ((some-tags (cl-subseq exiftool-tests--tags 2)))
 	(apply 'exiftool-copy temp-1 temp-2 some-tags)
-	(should (and (not (equal (apply 'exiftool-read temp-1 all-tags)
-				 (apply 'exiftool-read temp-2 all-tags)))
+	(should (and (not (equal (apply 'exiftool-read temp-1 exiftool-tests--tags)
+				 (apply 'exiftool-read temp-2 exiftool-tests--tags)))
 		     (equal (apply 'exiftool-read temp-1 some-tags)
 			    (apply 'exiftool-read temp-2 some-tags))))))))