From 3e8a08e454621588e5b87123b3e543ffa98ba04d Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 3 Oct 2023 17:12:51 -0400 Subject: [PATCH] Fix broken tests --- editor/document/row_test.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/editor/document/row_test.go b/editor/document/row_test.go index ccdfb6d..b9e448f 100644 --- a/editor/document/row_test.go +++ b/editor/document/row_test.go @@ -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 {