1 package views 2 3 import "testing" 4 5 func TestSetContent(t *testing.T) { 6 ta := &TextArea{} 7 8 ta.SetContent("This is a quite long line.") // This line is longer than 11. 9 ta.SetContent("Four.\nFive...\n...and Six.") //"...and Six." should be 11 long. 10 11 if ta.model.height != 3 { 12 t.Errorf("Incorrect height: %d, expected: %d", ta.model.height, 3) 13 } 14 if ta.model.width != 11 { 15 t.Errorf("Incorrect width: %d, expected: %d", ta.model.width, 11) 16 } 17 } 18