psi: trim() => trimTo()

This commit is contained in:
saxon 2019-01-10 17:31:14 +10:30
parent 7fe8356b11
commit 4b09a4f60a
2 changed files with 2 additions and 2 deletions

View File

@ -113,7 +113,7 @@ func UpdateLocation(d []byte, s string) error {
return nil return nil
} }
func trim(d []byte, t byte) []byte { func trimTo(d []byte, t byte) []byte {
for i, b := range d { for i, b := range d {
if b == t { if b == t {
return d[:i] return d[:i]

View File

@ -358,7 +358,7 @@ func TestLocationUpdate(t *testing.T) {
func TestTrim(t *testing.T) { func TestTrim(t *testing.T) {
test := []byte{0xa3, 0x01, 0x03, 0x00, 0xde} test := []byte{0xa3, 0x01, 0x03, 0x00, 0xde}
want := []byte{0xa3, 0x01, 0x03} want := []byte{0xa3, 0x01, 0x03}
got := trim(test, 0x00) got := trimTo(test, 0x00)
if !bytes.Equal(got, want) { if !bytes.Equal(got, want) {
t.Errorf(errCmp, "TestTrim", want, got) t.Errorf(errCmp, "TestTrim", want, got)
} }