Commits

Miki Tebeka  committed 141e0f9

Delete on exit and writer test

  • Participants
  • Parent commits 390d849
  • Branches write

Comments (0)

Files changed (1)

File test/csvlib_test.clj

     (is (= ((first records) "Funny") true))))
 
 (defn tempfile []
-  (.getCanonicalPath (File/createTempFile "-csvlib-" nil)))
+  (let [file (File/createTempFile "-csvlib-" nil)]
+    (.deleteOnExit file)
+    (.getCanonicalPath file)))
 
 (defmacro defwriter-test [test-name & body]
   `(deftest ~test-name
 (defwriter-test test-write-mapseq
   (write-csv [{"x" 1 "y" 2} {"x" 3 "y" 4}] tmp)
   (is (= (slurp tmp) "x,y\n1,2\n3,4\n")))
+
+(defwriter-test test-write-mapseq-with-headers
+  (write-csv [{"x" 1 "y" 2} {"x" 3 "y" 4}] tmp)
+  (is (= (slurp tmp) "x,y\n1,2\n3,4\n")))