Open zveinn opened 4 months ago
@zveinn Could you please add a test case?
Not really, Iยดm too busy to write that for you :S sorry @aymanbagabas
Here's the test code to be added...
func TestEmptyTable(t *testing.T) {
table := New().
StyleFunc(TableStyle).
Headers("Fruit", "Color", "Code")
expected := strings.TrimSpace(`
โโโโโโโโโฌโโโโโโโโฌโโโโโโโ
โ Fruit โ Color โ Code โ
โโโโโโโโโผโโโโโโโโผโโโโโโโค
โโโโโโโโโดโโโโโโโโดโโโโโโโ
`)
if stripString(table.String()) != expected {
t.Fatalf("expected:\n\n%s\n\ngot:\n\n%s", expected, stripString(table.String()))
}
}
leaving t.data as nil causes a panic if the table is re-rendered again without adding new rows