зеркало из https://github.com/github/ruby.git
* test/psych/test_yamldbm.rb: add test case.
* test/syck/test_yamldbm.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9bb327f132
Коммит
051aa44240
|
@ -1,3 +1,8 @@
|
|||
Sun Oct 02 12:14:06 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
|
||||
|
||||
* test/psych/test_yamldbm.rb: add test case.
|
||||
* test/syck/test_yamldbm.rb: ditto.
|
||||
|
||||
Sun Oct 2 11:28:09 2011 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||
|
||||
* lib/yaml/store.rb: make initialize method signature match the
|
||||
|
|
|
@ -157,5 +157,34 @@ module Psych
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче