test/lint/strings.rb in redis-3.0.4 vs test/lint/strings.rb in redis-3.0.5

- old
+ new

@@ -45,9 +45,46 @@ end end end end + def test_set_with_ex + return if version < "2.6.12" + + r.set("foo", "bar", :ex => 2) + assert_in_range 0..2, r.ttl("foo") + end + + def test_set_with_px + return if version < "2.6.12" + + r.set("foo", "bar", :px => 2000) + assert_in_range 0..2, r.ttl("foo") + end + + def test_set_with_nx + return if version < "2.6.12" + + r.set("foo", "qux", :nx => true) + assert !r.set("foo", "bar", :nx => true) + assert_equal "qux", r.get("foo") + + r.del("foo") + assert r.set("foo", "bar", :nx => true) + assert_equal "bar", r.get("foo") + end + + def test_set_with_xx + return if version < "2.6.12" + + r.set("foo", "qux") + assert r.set("foo", "bar", :xx => true) + assert_equal "bar", r.get("foo") + + r.del("foo") + assert !r.set("foo", "bar", :xx => true) + end + def test_setex assert r.setex("foo", 1, "bar") assert_equal "bar", r.get("foo") assert [0, 1].include? r.ttl("foo") end