From 0f331b1cc76fc0affa11723948528e8153332fb9 Mon Sep 17 00:00:00 2001 From: Matias Insaurralde Date: Tue, 11 Jan 2022 02:19:34 -0300 Subject: [PATCH] Fix more tests --- cmd_generic_test.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cmd_generic_test.go b/cmd_generic_test.go index e5d4d713..1188dda9 100644 --- a/cmd_generic_test.go +++ b/cmd_generic_test.go @@ -774,23 +774,21 @@ func TestCopy(t *testing.T) { s.Set("key1", "value") s.CheckGet(t, "key1", "value") s.Copy("key1", "key2") - must0(t, c, "COPY", "key1", "key2") + // should return 1 after a successful copy operation: + must1(t, c, "COPY", "key1", "key2") s.CheckGet(t, "key2", "value") - // should fail when trying to copy a nonexistent key: + // should return 0 when trying to copy a nonexistent key: t.Run("nonexistent key", func(t *testing.T) { - mustDo(t, c, - "COPY", "nosuch", "to", - proto.Error("ERR no such key"), - ) + must0(t, c, "COPY", "nosuch", "to") }) - // should return 1 when a key already exists: + // should return 0 when trying to overwrite an existing key: t.Run("existing key", func(t *testing.T) { s.Set("existingkey", "value") s.Set("newkey", "newvalue") - must1(t, c, "COPY", "newkey", "existingkey") - // existing key value should be preserved: + must0(t, c, "COPY", "newkey", "existingkey") + // existing key value should remain unchanged: s.CheckGet(t, "existingkey", "value") }) }