func testDump(t *testing.T, c *client.Conn) {
	ch, wa := c.Dump()
	ch <- [2][]byte{[]byte("testDumpk1"), []byte("testDumpv1")}
	ch <- [2][]byte{[]byte("testDumpk2"), []byte("testDumpv2")}
	close(ch)
	wa.Wait()
	if val, ex := c.Get([]byte("testDumpk1")); !ex || bytes.Compare(val, []byte("testDumpv1")) != 0 {
		t.Errorf("wrong value")
	}
	if val, ex := c.Get([]byte("testDumpk2")); !ex || bytes.Compare(val, []byte("testDumpv2")) != 0 {
		t.Errorf("wrong value")
	}
}
Beispiel #2
0
func get(conn *client.Conn, args []string) {
	if value, existed := conn.Get([]byte(args[1])); existed {
		fmt.Printf("%v\n", decode(value))
	}
}