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:
parent
41d5072573
commit
5159f500fd
3 changed files with 15 additions and 7 deletions
|
@ -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>
|
Sat Aug 30 02:48:11 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* object.c (rb_obj_freeze): update rdoc to mention RuntimeError
|
* object.c (rb_obj_freeze): update rdoc to mention RuntimeError
|
||||||
|
|
14
encoding.c
14
encoding.c
|
@ -880,13 +880,15 @@ enc_compatible_p(VALUE klass, VALUE str1, VALUE str2)
|
||||||
{
|
{
|
||||||
rb_encoding *enc;
|
rb_encoding *enc;
|
||||||
|
|
||||||
if (BUILTIN_TYPE(str1) != T_STRING && BUILTIN_TYPE(str1) != T_REGEXP) {
|
if (SPECIAL_CONST_P(str1) ||
|
||||||
rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
|
BUILTIN_TYPE(str1) != T_STRING && BUILTIN_TYPE(str1) != T_REGEXP) {
|
||||||
rb_obj_classname(str1));
|
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) ||
|
||||||
rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
|
BUILTIN_TYPE(str2) != T_STRING && BUILTIN_TYPE(str2) != T_REGEXP) {
|
||||||
rb_obj_classname(str2));
|
rb_raise(rb_eTypeError, "wrong argument type %s (expected String or Regexp)",
|
||||||
|
rb_obj_classname(str2));
|
||||||
}
|
}
|
||||||
if (!enc_capable(str1)) return Qnil;
|
if (!enc_capable(str1)) return Qnil;
|
||||||
if (!enc_capable(str2)) return Qnil;
|
if (!enc_capable(str2)) return Qnil;
|
||||||
|
|
|
@ -1280,7 +1280,7 @@ class TestM17N < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_compatible
|
def test_compatible
|
||||||
assert_equal(nil, Encoding.compatible?("",0), "moved from btest/knownbug")
|
assert_raise(TypeError) {Encoding.compatible?("",0)}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_force_encoding
|
def test_force_encoding
|
||||||
|
|
Loading…
Reference in a new issue