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