mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix test
Signed-off-by: demoManito <1430482733@qq.com>
This commit is contained in:
parent
72cf0cc04a
commit
5b26fc0101
@ -90,7 +90,7 @@ func (us *unsafeSet) Length() int {
|
||||
|
||||
// Values returns the values of the Set in an unspecified order.
|
||||
func (us *unsafeSet) Values() (values []string) {
|
||||
values = make([]string, 0)
|
||||
values = make([]string, 0, len(us.d))
|
||||
for val := range us.d {
|
||||
values = append(values, val)
|
||||
}
|
||||
|
@ -39,10 +39,9 @@ func equal(a, b []string) bool {
|
||||
|
||||
func driveSetTests(t *testing.T, s Set) {
|
||||
// Verify operations on an empty set
|
||||
var eValues []string
|
||||
values := s.Values()
|
||||
if !reflect.DeepEqual(values, eValues) {
|
||||
t.Fatalf("Expect values=%v got %v", eValues, values)
|
||||
if len(values) != 0 {
|
||||
t.Fatalf("Expect values=%v got %v", []string{}, values)
|
||||
}
|
||||
if l := s.Length(); l != 0 {
|
||||
t.Fatalf("Expected length=0, got %d", l)
|
||||
@ -58,7 +57,7 @@ func driveSetTests(t *testing.T, s Set) {
|
||||
s.Add("bar")
|
||||
s.Add("baz")
|
||||
|
||||
eValues = []string{"foo", "bar", "baz"}
|
||||
eValues := []string{"foo", "bar", "baz"}
|
||||
values = s.Values()
|
||||
if !equal(values, eValues) {
|
||||
t.Fatalf("Expect values=%v got %v", eValues, values)
|
||||
|
@ -353,17 +353,15 @@ func TestKVDeleteRange(t *testing.T) {
|
||||
ctx := context.TODO()
|
||||
|
||||
tests := []struct {
|
||||
key string
|
||||
opts []clientv3.OpOption
|
||||
|
||||
key string
|
||||
opts []clientv3.OpOption
|
||||
wkeys []string
|
||||
}{
|
||||
// *
|
||||
{
|
||||
key: "\x00",
|
||||
opts: []clientv3.OpOption{clientv3.WithFromKey()},
|
||||
|
||||
wkeys: []string{},
|
||||
key: "\x00",
|
||||
opts: []clientv3.OpOption{clientv3.WithFromKey()},
|
||||
wkeys: nil,
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user