mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
59dca19910
commit
668bd7d992
3 changed files with 9 additions and 1 deletions
|
@ -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>
|
Fri Dec 21 13:54:05 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* re.c: change "character encodings differ" error messages.
|
* 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 (rb_reg_fixed_encoding_p(re)) {
|
||||||
if (ENCODING_GET(re) != rb_enc_get_index(str) &&
|
if (ENCODING_GET(re) != rb_enc_get_index(str) &&
|
||||||
rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT) {
|
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 &&
|
else if ((enc = rb_enc_get(str)) != 0 &&
|
||||||
|
|
|
@ -4,6 +4,7 @@ require 'tmpdir'
|
||||||
|
|
||||||
class TestSystem < Test::Unit::TestCase
|
class TestSystem < Test::Unit::TestCase
|
||||||
def valid_syntax?(code, fname)
|
def valid_syntax?(code, fname)
|
||||||
|
code.force_encoding("ascii-8bit")
|
||||||
code = code.sub(/\A(?:\s*\#.*$)*(\n)?/n) {
|
code = code.sub(/\A(?:\s*\#.*$)*(\n)?/n) {
|
||||||
"#$&#{"\n" if $1 && !$2}BEGIN{return true}\n"
|
"#$&#{"\n" if $1 && !$2}BEGIN{return true}\n"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue