MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestHscan

Function TestHscan

IceFireDB-PubSub/test/cmd_hash_test.go:495–584  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

493}
494
495func TestHscan(t *testing.T) {
496 server.Clear()
497
498 c, err := proto.Dial(server.Addr())
499 ok(t, err)
500 defer c.Close()
501
502 // We cheat with hscan. It always returns everything.
503 directDo(t, c, "HSET", "h", "field1", "value1")
504 directDo(t, c, "HSET", "h", "field2", "value2")
505
506 // No problem
507 mustDo(t, c,
508 "HSCAN", "h", "0",
509 proto.Array(
510 proto.String("0"),
511 proto.Array(
512 proto.String("field1"),
513 proto.String("value1"),
514 proto.String("field2"),
515 proto.String("value2"),
516 ),
517 ),
518 )
519
520 // Invalid cursor
521 mustDo(t, c,
522 "HSCAN", "h", "42",
523 proto.Array(
524 proto.String("0"),
525 proto.Array(),
526 ),
527 )
528
529 // COUNT (ignored)
530 mustDo(t, c,
531 "HSCAN", "h", "0", "COUNT", "200",
532 proto.Array(
533 proto.String("0"),
534 proto.Array(
535 proto.String("field1"),
536 proto.String("value1"),
537 proto.String("field2"),
538 proto.String("value2"),
539 ),
540 ),
541 )
542
543 // MATCH
544 directDo(t, c, "HSET", "h", "aap", "a")
545 directDo(t, c, "HSET", "h", "noot", "b")
546 directDo(t, c, "HSET", "h", "mies", "m")
547 mustDo(t, c,
548 "HSCAN", "h", "0", "MATCH", "mi*",
549 proto.Array(
550 proto.String("0"),
551 proto.Array(
552 proto.String("mies"),

Callers

nothing calls this directly

Calls 12

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
ArrayFunction · 0.92
StringFunction · 0.92
ErrorFunction · 0.92
okFunction · 0.70
directDoFunction · 0.70
mustDoFunction · 0.70
errWrongNumberFunction · 0.70
CloseMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected