28 lines
450 B
Go
28 lines
450 B
Go
|
package editor
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestNewRow(t *testing.T) {
|
||
|
str := "abcdefg"
|
||
|
row := NewRow(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)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestRowSize(t *testing.T) {
|
||
|
str := "abcdefg"
|
||
|
row := NewRow(str)
|
||
|
|
||
|
got := row.Size()
|
||
|
want := 7
|
||
|
|
||
|
if got != want {
|
||
|
t.Errorf("Row size not equal to number of runes in original string")
|
||
|
}
|
||
|
}
|