mirror of https://bitbucket.org/ausocean/av.git
psi: trim() => trimTo()
This commit is contained in:
parent
7fe8356b11
commit
4b09a4f60a
|
@ -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]
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue