//stm: #unit package tablewriter import ( "os" "testing" "github.com/fatih/color" ) func TestTableWriter(t *testing.T) { //stm: @OTHER_IMPLEMENTATION_TABLE_WRITE_001, @OTHER_IMPLEMENTATION_TABLE_FLUSH_001 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) } }