Repository: zhiburt/tabled (language: rust)

Issue:
Builder::push_column cannot create new rows
https://github.com/zhiburt/tabled/blob/4ab897e7e4e6449dd51d3297229f072702dfc49d/tabled/src/builder/table_builder.rs#L281-L290

In the above code, `row` is not inserted into the table


Discussion / hints:
Hi @zxch3n 

Indeed ....

I wonder how I missed that..............

Don't you wanna open a PR?
If you try to, please create a small test see [`builder_test.rs`](https://github.com/zhiburt/tabled/blob/master/tabled/tests/core/builder_test.rs).


___________________

Funnily there's one more issue there.
Do you see it?

1, 2, 3....

Now I say

What if we pass an empty iterator
Then the inner vector will not correspond to `.count_columns`.

We need to update it even with empty iterator.
Hi. I'll create a PR.

> What if we pass an empty iterator
> Then the inner vector will not correspond to .count_columns.

What do you mean? It seems handled correctly by these code:

https://github.com/zhiburt/tabled/blob/4ab897e7e4e6449dd51d3297229f072702dfc49d/tabled/src/builder/table_builder.rs#L271-L279

Fix patch:
diff --git a/tabled/src/builder/table_builder.rs b/tabled/src/builder/table_builder.rs
index 64318b23..019180d7 100644
--- a/tabled/src/builder/table_builder.rs
+++ b/tabled/src/builder/table_builder.rs
@@ -287,6 +287,7 @@ impl Builder {
             }
 
             row.push(text);
+            self.data.push(row);
         }
 
         self.count_columns += 1;


Test patch:
diff --git a/tabled/tests/core/builder_test.rs b/tabled/tests/core/builder_test.rs
index dca4d27c..d945f4bc 100644
--- a/tabled/tests/core/builder_test.rs
+++ b/tabled/tests/core/builder_test.rs
@@ -129,6 +129,44 @@ test_table!(
     "+---+---+---+---+"
 );
 
+test_table!(
+    push_column_2,
+    {
+        let mut b = Builder::default();
+        b.push_column(["a", "d"]);
+        b.push_column(["b", "e"]);
+        b.push_column(["c", "f"]);
+        b.push_column(["g", "h"]);
+        b.build()
+    },
+    "+---+---+---+---+"
+    "| a | b | c | g |"
+    "+---+---+---+---+"
+    "| d | e | f | h |"
+    "+---+---+---+---+"
+);
+
+test_table!(
+    push_column_3,
+    {
+        let mut b = Builder::default();
+        b.push_column(["a", "d"]);
+        b.push_column(["b", "e"]);
+        b.push_column(["c", "f", "f"]);
+        b.push_column(["g", "h"]);
+        let a: [&str; 0] = [];
+        b.push_column(a);
+        b.build()
+    },
+    "+---+---+---+---+--+"
+    "| a | b | c | g |  |"
+    "+---+---+---+---+--+"
+    "| d | e | f | h |  |"
+    "+---+---+---+---+--+"
+    "|   |   | f |   |  |"
+    "+---+---+---+---+--+"
+);
+
 test_table!(
     insert_column_0,
     {