Skip to content

Commit

Permalink
Merge pull request #1 from bduggan/main
Browse files Browse the repository at this point in the history
Fix srem
  • Loading branch information
bduggan authored Jan 14, 2025
2 parents 2314dcf + 52981b9 commit c9dd69d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Redis.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ method srandmember(Str:D $key) {
}

method srem(Str:D $key, *@members --> Int:D) {
self.exec_command("SREM", |@members)
self.exec_command("SREM", $key, |@members)
}

method sunion(*@keys --> List:D) {
Expand Down
7 changes: 4 additions & 3 deletions t/02-sets.rakutest
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ use Redis;
use lib "t";
use Test::SpawnRedisServer;

plan 15;
plan 17;

if SpawnRedis() -> $proc {
LEAVE $proc.kill('INT');

my $r = Redis.new("127.0.0.1:63790", decode_response => True);
$r.auth('20bdfc8e73365b2fde82d7b17c3e429a9a94c5c9');
$r.flushall;

ok $r.sadd('abcd',1 );
ok $r.srem('abcd',"1" );

is-deeply $r.sadd("set1", 1, 2, 3, 4), 4;
is-deeply $r.scard("set1"), 4;
Expand All @@ -35,7 +36,7 @@ if SpawnRedis() -> $proc {
ok $r.srandmember("set_diff") eq any("1", "2", "3");

# srem
is-deeply $r.srem("set_inter", "3", "4"), 0;
is-deeply $r.srem("set_inter", "3", "4"), 1;

# sunion & sunionstore
is-deeply $r.sunion("set1", "set2"), ["1", "2", "3", "4"];
Expand Down

0 comments on commit c9dd69d

Please sign in to comment.