Skip to content

Commit

Permalink
Add tests for get_or_set.
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch committed Aug 1, 2016
1 parent 7da60d3 commit 57e6a36
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/filecache_test.rb
Expand Up @@ -12,6 +12,25 @@ def test_basic
f.set(KEY1, VALUE1)
assert_equal(f.get(KEY1), VALUE1, "set/get")

f.delete(KEY1)
assert_nil(f.get(KEY1), "delete")

assert_equal(
f.get_or_set(KEY1) do
VALUE1
end,
VALUE1,
"set_or_get"
)

assert_equal(
f.get_or_set(KEY1) do
VALUE2
end,
VALUE1,
"set_or_get"
)

f.delete(KEY1)
assert_nil(f.get(KEY1), "delete")

Expand Down

0 comments on commit 57e6a36

Please sign in to comment.