2021-04-01 12:02:17 -04:00
|
|
|
package editor
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestNewDocument(t *testing.T) {
|
|
|
|
d := newDocument()
|
|
|
|
|
|
|
|
if d == nil {
|
|
|
|
t.Errorf("Failed to create document")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestAppendRow(t *testing.T) {
|
|
|
|
d := newDocument()
|
|
|
|
d.appendRow("Test Row")
|
|
|
|
|
|
|
|
got := len(d.rows)
|
|
|
|
want := 1
|
|
|
|
|
|
|
|
if got != want {
|
|
|
|
t.Errorf("Failed to add a row to the document")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestRowCount(t *testing.T) {
|
|
|
|
d := newDocument()
|
|
|
|
d.appendRow("Test Row")
|
|
|
|
|
|
|
|
got := d.rowCount()
|
|
|
|
want := 1
|
|
|
|
|
|
|
|
if got != want {
|
|
|
|
t.Errorf("Expected %d rows, got %d rows", want, got)
|
|
|
|
}
|
2021-04-01 16:17:13 -04:00
|
|
|
}
|