mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_dir.rb: add tests to achieve over 90% test coverage
of dir.c. * test/ruby/test_encoding.rb: add tests for dummy?, name_list and aliases. * test/ruby/test_marshal.rb: add some tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
87050da59f
commit
9f42dfa012
4 changed files with 219 additions and 0 deletions
|
@ -25,4 +25,30 @@ class TestEncoding < Test::Unit::TestCase
|
|||
assert_equal(e.object_id, Marshal.load(Marshal.dump(e)).object_id)
|
||||
end
|
||||
end
|
||||
|
||||
def test_find
|
||||
assert_raise(ArgumentError) { Encoding.find("foobarbazqux") }
|
||||
end
|
||||
|
||||
def test_dummy_p
|
||||
assert_equal(true, Encoding::ISO_2022_JP.dummy?)
|
||||
assert_equal(false, Encoding::UTF_8.dummy?)
|
||||
end
|
||||
|
||||
def test_name_list
|
||||
assert_instance_of(Array, Encoding.name_list)
|
||||
Encoding.name_list.each do |x|
|
||||
assert_instance_of(String, x)
|
||||
end
|
||||
end
|
||||
|
||||
def test_aliases
|
||||
assert_instance_of(Hash, Encoding.aliases)
|
||||
Encoding.aliases.each do |k, v|
|
||||
assert(Encoding.name_list.include?(k))
|
||||
assert(Encoding.name_list.include?(v))
|
||||
assert_instance_of(String, k)
|
||||
assert_instance_of(String, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue