зеркало из https://github.com/github/ruby.git
transcode.c: use string
* transcode.c (econv_opts): get rid of inadvertent ID creation, and preserve argument encoding in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d0987afc74
Коммит
fdfb939d72
|
@ -908,6 +908,9 @@ class TestEncodingConverter < Test::Unit::TestCase
|
||||||
ec1 = Encoding::Converter.new("", "", universal_newline: true)
|
ec1 = Encoding::Converter.new("", "", universal_newline: true)
|
||||||
ec2 = Encoding::Converter.new("", "", newline: :universal)
|
ec2 = Encoding::Converter.new("", "", newline: :universal)
|
||||||
assert_equal(ec1, ec2)
|
assert_equal(ec1, ec2)
|
||||||
|
assert_raise_with_message(ArgumentError, /\u{3042}/) {
|
||||||
|
Encoding::Converter.new("", "", newline: "\u{3042}".to_sym)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_default_external
|
def test_default_external
|
||||||
|
|
|
@ -2487,8 +2487,8 @@ econv_opts(VALUE opt, int ecflags)
|
||||||
/* ecflags |= ECONV_LF_NEWLINE_DECORATOR; */
|
/* ecflags |= ECONV_LF_NEWLINE_DECORATOR; */
|
||||||
}
|
}
|
||||||
else if (SYMBOL_P(v)) {
|
else if (SYMBOL_P(v)) {
|
||||||
rb_raise(rb_eArgError, "unexpected value for newline option: %s",
|
rb_raise(rb_eArgError, "unexpected value for newline option: %"PRIsVALUE,
|
||||||
rb_id2name(SYM2ID(v)));
|
rb_sym2str(v));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_raise(rb_eArgError, "unexpected value for newline option");
|
rb_raise(rb_eArgError, "unexpected value for newline option");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче