зеркало из https://github.com/github/ruby.git
* test/ruby/test_system.rb (TestSystem::valid_syntax): apply
ASCII-8BIT encoding explicitly. * re.c (rb_reg_prepare_re): add encoding name in the message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
59dca19910
Коммит
668bd7d992
|
@ -1,3 +1,10 @@
|
|||
Fri Dec 21 14:01:14 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* test/ruby/test_system.rb (TestSystem::valid_syntax): apply
|
||||
ASCII-8BIT encoding explicitly.
|
||||
|
||||
* re.c (rb_reg_prepare_re): add encoding name in the message.
|
||||
|
||||
Fri Dec 21 13:54:05 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* re.c: change "character encodings differ" error messages.
|
||||
|
|
2
re.c
2
re.c
|
@ -943,7 +943,7 @@ rb_reg_prepare_re(VALUE re, VALUE str)
|
|||
if (rb_reg_fixed_encoding_p(re)) {
|
||||
if (ENCODING_GET(re) != rb_enc_get_index(str) &&
|
||||
rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT) {
|
||||
rb_raise(rb_eArgError, "fixed character encoding regexp with incompatible string");
|
||||
rb_raise(rb_eArgError, "fixed character encoding regexp with incompatible string (encoding: %s)", rb_enc_name(rb_enc_get(str)));
|
||||
}
|
||||
}
|
||||
else if ((enc = rb_enc_get(str)) != 0 &&
|
||||
|
|
|
@ -4,6 +4,7 @@ require 'tmpdir'
|
|||
|
||||
class TestSystem < Test::Unit::TestCase
|
||||
def valid_syntax?(code, fname)
|
||||
code.force_encoding("ascii-8bit")
|
||||
code = code.sub(/\A(?:\s*\#.*$)*(\n)?/n) {
|
||||
"#$&#{"\n" if $1 && !$2}BEGIN{return true}\n"
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче