Commits

Miki Tebeka  committed ceb8a9e

More testing (format fails)

  • Participants
  • Parent commits f180309
  • Branches write

Comments (0)

Files changed (1)

File test/csvlib_test.clj

     (write-csv [[1 2 3] [4 5 6]] tmp)
     (is (= (slurp tmp) "1,2,3\n4,5,6\n"))))
 
+(deftest test-write-headers
+  (let [tmp (tempfile)]
+    (write-csv [[1 2 3] [4 5 6]] tmp :headers ["x" "y" "z"])
+    (is (= (slurp tmp) "x,y,z\n1,2,3\n4,5,6\n"))))
+
+(deftest test-write-format
+  (let [tmp (tempfile)
+        format {0 #(format "format %s" %)}]
+    (write-csv [[1 2 3] [4 5 6]] tmp format)
+    (is (= (slurp tmp) "format-1,2,3\nformat-4,5,6\n"))))
+