зеркало из https://github.com/github/ruby.git
Add rdoc and test of Encoding#replicate.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
190507ce0c
Коммит
07f81c06ca
|
@ -313,6 +313,15 @@ rb_enc_replicate(const char *name, rb_encoding *encoding)
|
|||
return idx;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* enc.replicate(name) => encoding
|
||||
*
|
||||
* Returns a replicated encoding of _enc whose name is _name_.
|
||||
* The new encoding should have the same byte structure of _enc_.
|
||||
* If _name_ is used by another encoding, raise ArgumentError.
|
||||
*
|
||||
*/
|
||||
static VALUE
|
||||
enc_replicate(VALUE encoding, VALUE name)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,11 @@ class TestEncoding < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_replicate
|
||||
assert(Encoding::UTF_8.replicate('UTF-8-ANOTHER'))
|
||||
assert(Encoding::ISO_2022_JP.replicate('ISO-2022-JP-ANOTHER'))
|
||||
end
|
||||
|
||||
def test_dummy_p
|
||||
assert_equal(true, Encoding::ISO_2022_JP.dummy?)
|
||||
assert_equal(false, Encoding::UTF_8.dummy?)
|
||||
|
|
Загрузка…
Ссылка в новой задаче