Commits

Miki Tebeka  committed 821b3da

Typo

  • Participants
  • Parent commits 9397c70
  • Branches write

Comments (0)

Files changed (2)

File src/csvlib.clj

     (and (nil? headers) (vector? record)) nil
     (vector? headers) headers
     (map? headers) (vectorize-headers headers)
-    (map? record) (vectorize-headers headers)))
+    (map? record) (vectorize-headers record)))
 
 (defn keyset
   "Return a set of map keys."
   "Sort record by headers. Return a sequence of values."
   [record headers]
   (when (unknowns? record headers) (throw (Exception. "unknown fields")))
-  (map #(get % record "") headers))
+  (map #(get % record nil) headers))
 
 (defn gen-values 
   "Generate values seq from a record."

File test/csvlib_test.clj

   (let [format {0 #(format "format-%s" %)}]
     (write-csv [[1 2 3] [4 5 6]] tmp :format format)
     (is (= (slurp tmp) "format-1,2,3\nformat-4,5,6\n"))))
+
+;(defwriter-test test-write-mapseq
+;  (write-csv [{"x" 1 "y" 2} {"x" 3 "y" 4}] tmp))