mirror of
https://github.com/nikdoof/vsphere-influxdb-go.git
synced 2025-12-20 05:59:21 +00:00
add vendoring with go dep
This commit is contained in:
68
vendor/github.com/influxdata/influxdb/pkg/escape/bytes_test.go
generated
vendored
Normal file
68
vendor/github.com/influxdata/influxdb/pkg/escape/bytes_test.go
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
package escape
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUnescape(t *testing.T) {
|
||||
tests := []struct {
|
||||
in []byte
|
||||
out []byte
|
||||
}{
|
||||
{
|
||||
[]byte(nil),
|
||||
[]byte(nil),
|
||||
},
|
||||
|
||||
{
|
||||
[]byte(""),
|
||||
[]byte(nil),
|
||||
},
|
||||
|
||||
{
|
||||
[]byte("\\,\\\"\\ \\="),
|
||||
[]byte(",\" ="),
|
||||
},
|
||||
|
||||
{
|
||||
[]byte("\\\\"),
|
||||
[]byte("\\\\"),
|
||||
},
|
||||
|
||||
{
|
||||
[]byte("plain and simple"),
|
||||
[]byte("plain and simple"),
|
||||
},
|
||||
}
|
||||
|
||||
for ii, tt := range tests {
|
||||
got := Unescape(tt.in)
|
||||
if !reflect.DeepEqual(got, tt.out) {
|
||||
t.Errorf("[%d] Unescape(%#v) = %#v, expected %#v", ii, string(tt.in), string(got), string(tt.out))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppendUnescaped(t *testing.T) {
|
||||
cases := strings.Split(strings.TrimSpace(`
|
||||
normal
|
||||
inv\alid
|
||||
goo\"d
|
||||
sp\ ace
|
||||
\,\"\ \=
|
||||
f\\\ x
|
||||
`), "\n")
|
||||
|
||||
for _, c := range cases {
|
||||
exp := Unescape([]byte(c))
|
||||
got := AppendUnescaped(nil, []byte(c))
|
||||
|
||||
if !bytes.Equal(got, exp) {
|
||||
t.Errorf("AppendUnescaped failed for %#q: got %#q, exp %#q", c, got, exp)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user