This commit is contained in:
parent
cc99f08747
commit
3e8a08e454
@ -2,21 +2,23 @@ package document
|
||||
|
||||
import "testing"
|
||||
|
||||
var doc = NewDocument()
|
||||
|
||||
func TestNewRow(t *testing.T) {
|
||||
str := "abcdefg"
|
||||
row := newRow(str)
|
||||
row := newRow(doc, str)
|
||||
|
||||
got := string(row.chars)
|
||||
want := str
|
||||
|
||||
if got != want {
|
||||
t.Errorf("Row chars not equal to original string. Row: %q, String: %q", row, str)
|
||||
t.Errorf("Row chars not equal to original string. Row: %q, String: %q", row.chars, str)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRowSize(t *testing.T) {
|
||||
str := "abcdefg"
|
||||
row := newRow(str)
|
||||
row := newRow(doc, str)
|
||||
|
||||
got := row.Size()
|
||||
want := 7
|
||||
@ -28,7 +30,7 @@ func TestRowSize(t *testing.T) {
|
||||
|
||||
func TestRenderSize(t *testing.T) {
|
||||
str := "\tabcdefg"
|
||||
row := newRow(str)
|
||||
row := newRow(doc, str)
|
||||
row.update()
|
||||
|
||||
got := row.RenderSize()
|
||||
@ -55,7 +57,7 @@ var insertRuneTests = []insertRune{
|
||||
|
||||
func TestInsertRune(t *testing.T) {
|
||||
for _, test := range insertRuneTests {
|
||||
row := newRow(test.initial)
|
||||
row := newRow(doc, test.initial)
|
||||
row.insertRune(test.ch, test.at)
|
||||
|
||||
if row.Size() != 5 {
|
||||
|
Loading…
Reference in New Issue
Block a user