Sha256: 773399009d1228c331dec01be5dfb615014bce97df9ae78ae85b47d5ea84a1d9
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
# encoding: UTF-8 require File.expand_path("./helper", File.dirname(__FILE__)) setup do init Redis.new(OPTIONS) end load './test/lint/lists.rb' test "RPUSHX" do |r| r.rpushx "foo", "s1" r.rpush "foo", "s2" r.rpushx "foo", "s3" assert 2 == r.llen("foo") assert ["s2", "s3"] == r.lrange("foo", 0, -1) end test "LPUSHX" do |r| r.lpushx "foo", "s1" r.lpush "foo", "s2" r.lpushx "foo", "s3" assert 2 == r.llen("foo") assert ["s3", "s2"] == r.lrange("foo", 0, -1) end test "LINSERT" do |r| r.rpush "foo", "s1" r.rpush "foo", "s3" r.linsert "foo", :before, "s3", "s2" assert ["s1", "s2", "s3"] == r.lrange("foo", 0, -1) assert_raise(Redis::CommandError) do r.linsert "foo", :anywhere, "s3", "s2" end end test "RPOPLPUSH" do |r| r.rpush "foo", "s1" r.rpush "foo", "s2" assert "s2" == r.rpoplpush("foo", "bar") assert ["s2"] == r.lrange("bar", 0, -1) assert "s1" == r.rpoplpush("foo", "bar") assert ["s1", "s2"] == r.lrange("bar", 0, -1) end test "BRPOPLPUSH" do |r| r.rpush "foo", "s1" r.rpush "foo", "s2" assert_equal "s2", r.brpoplpush("foo", "bar", 1) assert_equal nil, r.brpoplpush("baz", "qux", 1) assert_equal ["s2"], r.lrange("bar", 0, -1) end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
gorsuch-redis-3.0.0.rc1 | test/commands_on_lists_test.rb |
redis-3.0.0.rc1 | test/commands_on_lists_test.rb |