35 lines
494 B
Go
35 lines
494 B
Go
|
package editor
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestNew(t *testing.T) {
|
||
|
e := New()
|
||
|
|
||
|
if e == nil {
|
||
|
t.Errorf("Failed to create editor")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestAppendRow(t *testing.T) {
|
||
|
e := New()
|
||
|
e.appendRow("Test Row")
|
||
|
|
||
|
got := len(e.rows)
|
||
|
want := 1
|
||
|
|
||
|
if got != want {
|
||
|
t.Errorf("Failed to add a row to the editor")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestRowCount(t *testing.T) {
|
||
|
e := New()
|
||
|
e.appendRow("Test Row")
|
||
|
|
||
|
got := e.rowCount()
|
||
|
want := 1
|
||
|
|
||
|
if got != want {
|
||
|
t.Errorf("Expected %d rows, got %d rows", want, got)
|
||
|
}
|
||
|
}
|