1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* encoding.c (enc_compatible_p): add SPECIAL_CONST_P check.

* test/ruby/test_m17n.rb (test_compatible): fix test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-08-29 22:50:16 +00:00
parent 41d5072573
commit 5159f500fd
3 changed files with 15 additions and 7 deletions

View file

@ -1,3 +1,9 @@
Sat Aug 30 07:48:48 2008 NARUSE, Yui <naruse@ruby-lang.org>
* encoding.c (enc_compatible_p): add SPECIAL_CONST_P check.
* test/ruby/test_m17n.rb (test_compatible): fix test.
Sat Aug 30 02:48:11 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* object.c (rb_obj_freeze): update rdoc to mention RuntimeError

View file

@ -880,11 +880,13 @@ enc_compatible_p(VALUE klass, VALUE str1, VALUE str2)
{
rb_encoding *enc;
if (BUILTIN_TYPE(str1) != T_STRING && BUILTIN_TYPE(str1) != T_REGEXP) {
if (SPECIAL_CONST_P(str1) ||
BUILTIN_TYPE(str1) != T_STRING && BUILTIN_TYPE(str1) != T_REGEXP) {
rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
rb_obj_classname(str1));
}
if (BUILTIN_TYPE(str2) != T_STRING && BUILTIN_TYPE(str2) != T_REGEXP) {
if (SPECIAL_CONST_P(str2) ||
BUILTIN_TYPE(str2) != T_STRING && BUILTIN_TYPE(str2) != T_REGEXP) {
rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
rb_obj_classname(str2));
}

View file

@ -1280,7 +1280,7 @@ class TestM17N < Test::Unit::TestCase
end
def test_compatible
assert_equal(nil, Encoding.compatible?("",0), "moved from btest/knownbug")
assert_raise(TypeError) {Encoding.compatible?("",0)}
end
def test_force_encoding