Test SDIFF *func TestSdiff(t *testing.T) { server.Clear() c, err := proto.Dial(server.Addr()) ok(t, err) defer c.Close() s := server.Direct() s.SetAdd("s1", "aap", "noot", "mies") s.SetAdd("s2", "noot", "mies", "vuur") s.SetAdd("s3", "aap", "mies", "wim") // Simple case mustDo(t, c, "S
(t *testing.T)
| 748 | } |
| 749 | */ |
| 750 | func TestSscan(t *testing.T) { |
| 751 | server.Clear() |
| 752 | c, err := proto.Dial(server.Addr()) |
| 753 | ok(t, err) |
| 754 | defer c.Close() |
| 755 | s := server.Direct() |
| 756 | |
| 757 | // We cheat with sscan. It always returns everything. |
| 758 | |
| 759 | s.SetAdd("set", "value1", "value2") |
| 760 | |
| 761 | // No problem |
| 762 | mustDo(t, c, |
| 763 | "SSCAN", "set", "0", |
| 764 | proto.Array( |
| 765 | proto.String("0"), |
| 766 | proto.Array( |
| 767 | proto.String("value1"), |
| 768 | proto.String("value2"), |
| 769 | ), |
| 770 | ), |
| 771 | ) |
| 772 | |
| 773 | // Invalid cursor |
| 774 | mustDo(t, c, |
| 775 | "SSCAN", "set", "42", |
| 776 | proto.Array( |
| 777 | proto.String("0"), |
| 778 | proto.Strings(), |
| 779 | ), |
| 780 | ) |
| 781 | |
| 782 | // COUNT (ignored) |
| 783 | mustDo(t, c, |
| 784 | "SSCAN", "set", "0", "COUNT", "200", |
| 785 | proto.Array( |
| 786 | proto.String("0"), |
| 787 | proto.Array( |
| 788 | proto.String("value1"), |
| 789 | proto.String("value2"), |
| 790 | ), |
| 791 | ), |
| 792 | ) |
| 793 | |
| 794 | // MATCH |
| 795 | s.SetAdd("set", "aap", "noot", "mies") |
| 796 | mustDo(t, c, |
| 797 | "SSCAN", "set", "0", "MATCH", "mi*", |
| 798 | proto.Array( |
| 799 | proto.String("0"), |
| 800 | proto.Array( |
| 801 | proto.String("mies"), |
| 802 | ), |
| 803 | ), |
| 804 | ) |
| 805 | |
| 806 | t.Run("errors", func(t *testing.T) { |
| 807 | mustDo(t, c, |
nothing calls this directly
no test coverage detected