package gilo import "testing" func TestBuffer_AppendRune(t *testing.T) { b := NewBuffer() got := b.AppendRune('a') want := 1 if got != want { t.Errorf("Wrong length for rune, got %q, expected %q for rune %c", got, want, 'a') } } func TestBuffer_Append(t *testing.T) { b := NewBuffer() got := b.Append("123") want := 3 if got != want { t.Errorf("Wrong length for string, got %d, expected %d for input '%s'", got, want, "123") } } func TestBuffer_AppendLn(t *testing.T) { b := NewBuffer() got := b.AppendLn("123") // Adds carriage return and line feed want := 5 if got != want { t.Errorf("Wrong length for string, got %d, expected %d for input '%s'", got, want, "123") } } func TestBuffer_ToString(t *testing.T) { b := NewBuffer() b.Append("foo") got := b.ToString() want := "foo" if got != want { t.Errorf("Failed to convert to proper string") } } func TestBuffer_Len(t *testing.T) { b := NewBuffer() b.Append("foo") got := b.Len() want := 3 if got != want { t.Errorf("Wrong length for string, got %d, expected %d", got, want) } }