Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from leathekd/master

Update table* to handle nil and empty list argument
  • Loading branch information...
commit bc45e8cc977aa6d421c7333a135741cb8c919ab8 2 parents cd3b543 + 6caafdf
Joe Gallo authored
Showing with 10 additions and 1 deletion.
  1. +1 −1  src/doric/core.clj
  2. +9 −0 test/doric/test/core.clj
2  src/doric/core.clj
View
@@ -130,7 +130,7 @@
(defn table*
([rows]
- (table* (vary-meta (keys (first rows))
+ (table* (vary-meta (or (keys (first rows)) [])
merge (meta rows)) rows))
([cols rows]
(let [meta (meta cols)
9 test/doric/test/core.clj
View
@@ -105,3 +105,12 @@
{:name :2 :format inc :width 0}]
[{:1 3 :2 4}])]
(is (= 0 @calls))))))
+
+(deftest test-empty-table
+ (let [empty-table "|--|\n| |\n|--|\n|--|"]
+ (is (= empty-table (table [])))
+ (is (= empty-table (table nil)))
+ (is (= empty-table (table [] [])))
+ (is (= empty-table (table [] nil)))
+ (is (= empty-table (table nil [])))
+ (is (= empty-table (table nil nil)))))
Please sign in to comment.
Something went wrong with that request. Please try again.