mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
encoding.c: enc_capable symbol
* encoding.c (enc_capable): Symbol is now encoding capable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
623da1525a
commit
45fff5150a
2 changed files with 4 additions and 0 deletions
|
@ -720,6 +720,7 @@ enc_capable(VALUE obj)
|
|||
case T_STRING:
|
||||
case T_REGEXP:
|
||||
case T_FILE:
|
||||
case T_SYMBOL:
|
||||
return TRUE;
|
||||
case T_DATA:
|
||||
if (is_data_encoding(obj)) return TRUE;
|
||||
|
|
|
@ -107,6 +107,9 @@ class TestEncoding < Test::Unit::TestCase
|
|||
bin = "a".force_encoding(Encoding::ASCII_8BIT)
|
||||
asc = "b".force_encoding(Encoding::US_ASCII)
|
||||
assert_equal(Encoding::ASCII_8BIT, Encoding.compatible?(bin, asc))
|
||||
bin = "\xff".force_encoding(Encoding::ASCII_8BIT).to_sym
|
||||
asc = "b".force_encoding(Encoding::ASCII_8BIT)
|
||||
assert_equal(Encoding::ASCII_8BIT, Encoding.compatible?(bin, asc))
|
||||
end
|
||||
|
||||
def test_errinfo_after_autoload
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue