1// Copyright 2017 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package edit
6
7import "testing"
8
9func TestEdit(t *testing.T) {
10	b := NewBuffer([]byte("0123456789"))
11	b.Insert(8, ",7½,")
12	b.Replace(9, 10, "the-end")
13	b.Insert(10, "!")
14	b.Insert(4, "3.14,")
15	b.Insert(4, "π,")
16	b.Insert(4, "3.15,")
17	b.Replace(3, 4, "three,")
18	want := "012three,3.14,π,3.15,4567,7½,8the-end!"
19
20	s := b.String()
21	if s != want {
22		t.Errorf("b.String() = %q, want %q", s, want)
23	}
24	sb := b.Bytes()
25	if string(sb) != want {
26		t.Errorf("b.Bytes() = %q, want %q", sb, want)
27	}
28}
29