mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/iconv/test_simple.rb: added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9eec758a1e
commit
28c5fe3c6c
1 changed files with 27 additions and 0 deletions
27
test/iconv/test_simple.rb
Normal file
27
test/iconv/test_simple.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
require 'test/unit'
|
||||
begin
|
||||
require 'iconv'
|
||||
rescue LoadError
|
||||
end
|
||||
|
||||
class TestIConv < Test::Unit::TestCase
|
||||
ASCII = "ascii"
|
||||
def test_simple
|
||||
c = Iconv.open(ASCII, ASCII)
|
||||
ref = '[ruby-core:17092]'
|
||||
rescue
|
||||
return
|
||||
else
|
||||
assert_equal("abc", c.iconv("abc"))
|
||||
assert_equal("c", c.iconv("abc", 2), "#{ref}: with start")
|
||||
assert_equal("c", c.iconv("abc", 2, 1), "#{ref}: with start, length")
|
||||
assert_equal("c", c.iconv("abc", 2, 5), "#{ref}: with start, longer length")
|
||||
assert_equal("bc", c.iconv("abc", -2), "#{ref}: with nagative start")
|
||||
assert_equal("b", c.iconv("abc", -2, 1), "#{ref}: with nagative start, length")
|
||||
assert_equal("bc", c.iconv("abc", -2, 5), "#{ref}: with nagative start, longer length")
|
||||
assert_equal("", c.iconv("abc", 5), "#{ref}: with OOB")
|
||||
assert_equal("", c.iconv("abc", 5, 2), "#{ref}: with OOB, length")
|
||||
ensure
|
||||
c.close if c
|
||||
end
|
||||
end if defined?(::Iconv)
|
Loading…
Add table
Reference in a new issue