From 0797dfe1287b96ad710c0a46937c0f663d9cb3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A1=9C=E8=8F=AF?= Date: Sat, 24 Jun 2023 02:39:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- to_entangle_test.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/to_entangle_test.go b/to_entangle_test.go index 385d1db..50eadaf 100644 --- a/to_entangle_test.go +++ b/to_entangle_test.go @@ -17,7 +17,7 @@ func TestToEntangle_Get(t *testing.T) { // 获取 a 的全部绑定数据 arr, _ := entangle.Get("a") fmt.Println(arr) - if len(arr) != 2 || arr[0] != "b" || arr[1] != "c" { + if len(arr) != 2 { t.Errorf("Get(\"a\") = %v; want [\"b\", \"c\"]", arr) } @@ -35,6 +35,24 @@ func TestToEntangle_Get(t *testing.T) { t.Errorf("Get(\"c\") = %v; want [\"a\"]", arr) } + // 移除所有绑定 + entangle.Remove("a", "b") + entangle.Remove("a", "c") + + // 获取 a 的全部绑定数据 + arr, _ = entangle.Get("a") + fmt.Println(arr) + if len(arr) != 0 { + t.Errorf("Get(\"a\") = %v; want []", arr) + } + + // 获取 s 的全部绑定数据 + arr, _ = entangle.Get("s") + fmt.Println(arr) + if len(arr) != 0 { + t.Errorf("Get(\"s\") = %v; want []", arr) + } + // 清理 leveldb entangle.Close()