* re.c (rb_reg_preprocess_dregexp): change Exception class to

RegexpError.

* test/ruby/test_m17n.rb (test_regexp_usascii): follow above.

* test/ruby/test_m17n.rb (test_regexp_embed): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2009-08-14 09:05:44 +00:00
Родитель 2b91cbbf11
Коммит 4155811dc1
3 изменённых файлов: 17 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Fri Aug 14 17:59:12 2009 NARUSE, Yui <naruse@ruby-lang.org>
* re.c (rb_reg_preprocess_dregexp): change Exception class to
RegexpError.
* test/ruby/test_m17n.rb (test_regexp_usascii): follow above.
* test/ruby/test_m17n.rb (test_regexp_embed): ditto.
Fri Aug 14 17:17:42 2009 NARUSE, Yui <naruse@ruby-lang.org>
* enc/Makefile.in (MKDIRS): revert r24525.

2
re.c
Просмотреть файл

@ -2301,7 +2301,7 @@ rb_reg_preprocess_dregexp(VALUE ary, int options)
if (fixed_enc != 0) {
if (regexp_enc != 0 && regexp_enc != fixed_enc) {
rb_raise(rb_eArgError, "encoding mismatch in dynamic regexp : %s and %s",
rb_raise(rb_eRegexpError, "encoding mismatch in dynamic regexp : %s and %s",
rb_enc_name(regexp_enc), rb_enc_name(fixed_enc));
}
regexp_enc = fixed_enc;

Просмотреть файл

@ -442,18 +442,18 @@ class TestM17N < Test::Unit::TestCase
def test_regexp_embed
r = eval(e("/\xc2\xa1/"))
assert_raise(ArgumentError) { eval(s("/\xc2\xa1\#{r}/s")) }
assert_raise(ArgumentError) { eval(s("/\#{r}\xc2\xa1/s")) }
assert_raise(RegexpError) { eval(s("/\xc2\xa1\#{r}/s")) }
assert_raise(RegexpError) { eval(s("/\#{r}\xc2\xa1/s")) }
r = /\xc2\xa1/e
assert_raise(ArgumentError) { eval(s("/\xc2\xa1\#{r}/s")) }
assert_raise(ArgumentError) { eval(s("/\#{r}\xc2\xa1/s")) }
assert_raise(RegexpError) { eval(s("/\xc2\xa1\#{r}/s")) }
assert_raise(RegexpError) { eval(s("/\#{r}\xc2\xa1/s")) }
r = eval(e("/\xc2\xa1/"))
assert_raise(ArgumentError) { /\xc2\xa1#{r}/s }
assert_raise(RegexpError) { /\xc2\xa1#{r}/s }
r = /\xc2\xa1/e
assert_raise(ArgumentError) { /\xc2\xa1#{r}/s }
assert_raise(RegexpError) { /\xc2\xa1#{r}/s }
r1 = Regexp.new('foo'.force_encoding("ascii-8bit"))
r2 = eval('/bar#{r1}/'.force_encoding('ascii-8bit'))
@ -1255,7 +1255,7 @@ class TestM17N < Test::Unit::TestCase
assert_regexp_usascii_literal('/\u1234#{%q"\x80"}/', nil, SyntaxError)
assert_regexp_usascii_literal('/\u1234#{"\x80"}/', nil, SyntaxError)
assert_regexp_usascii_literal('/\u1234\x80/', nil, SyntaxError)
assert_regexp_usascii_literal('/\u1234#{}\x80/', nil, ArgumentError)
assert_regexp_usascii_literal('/\u1234#{}\x80/', nil, RegexpError)
end
def test_gbk