summaryrefslogtreecommitdiff
path: root/test/syck/test_yamldbm.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/syck/test_yamldbm.rb')
-rw-r--r--test/syck/test_yamldbm.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/syck/test_yamldbm.rb b/test/syck/test_yamldbm.rb
index 85255eded4..f017dd090d 100644
--- a/test/syck/test_yamldbm.rb
+++ b/test/syck/test_yamldbm.rb
@@ -157,5 +157,34 @@ module Syck
assert_equal({'a'=>'b','e'=>'f'}, @yamldbm.reject {|k,v| v == 'd'})
assert_equal({'a'=>'b','c'=>'d','e'=>'f'}, @yamldbm.reject {false})
end
+
+ def test_values
+ assert_equal [], @yamldbm.values
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal ['b','d'], @yamldbm.values
+ end
+
+ def test_values_at
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ assert_equal ['b','d'], @yamldbm.values_at('a','c')
+ end
+
+ def test_selsct
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ @yamldbm['e'] = 'f'
+ assert_equal(['b','d'], @yamldbm.select('a','c'))
+ end
+
+ def test_selsct_with_block
+ @yamldbm['a'] = 'b'
+ @yamldbm['c'] = 'd'
+ @yamldbm['e'] = 'f'
+ assert_equal([['a','b']], @yamldbm.select {|k,v| k == 'a'})
+ assert_equal([['c','d']], @yamldbm.select {|k,v| v == 'd'})
+ assert_equal([], @yamldbm.select {false})
+ end
end
end