gilo/internal/editor/document/document_test.go

36 lines
533 B
Go
Raw Normal View History

2021-04-02 15:36:43 -04:00
package document
import "testing"
func TestNewDocument(t *testing.T) {
2021-04-02 14:52:44 -04:00
d := NewDocument()
if d == nil {
2021-04-02 14:52:44 -04:00
t.Errorf("Failed to create Document")
}
}
func TestAppendRow(t *testing.T) {
2021-04-02 14:52:44 -04:00
d := NewDocument()
d.AppendRow("Test Row")
got := len(d.rows)
want := 1
if got != want {
2021-04-02 14:52:44 -04:00
t.Errorf("Failed to add a row to the Document")
}
}
func TestRowCount(t *testing.T) {
2021-04-02 14:52:44 -04:00
d := NewDocument()
d.AppendRow("Test Row")
2021-04-02 14:52:44 -04:00
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
}