lotus/lib/tablewriter/tablewiter_test.go
Łukasz Magiera e4f475ee59 gofmt
2020-08-04 19:07:31 +02:00

35 lines
668 B
Go

package tablewriter
import (
"os"
"testing"
"github.com/fatih/color"
)
func TestTableWriter(t *testing.T) {
tw := New(Col("C1"), Col("X"), Col("C333"), NewLineCol("Thing"))
tw.Write(map[string]interface{}{
"C1": "234",
"C333": "ou",
})
tw.Write(map[string]interface{}{
"C1": "23uieui4",
"C333": "ou",
"X": color.GreenString("#"),
"Thing": "a very long thing, annoyingly so",
})
tw.Write(map[string]interface{}{
"C1": "ttttttttt",
"C333": "eui",
})
tw.Write(map[string]interface{}{
"C1": "1",
"C333": "2",
"SurpriseColumn": "42",
})
if err := tw.Flush(os.Stdout); err != nil {
t.Fatal(err)
}
}