mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
refine a warning message.
The "n" option for regexp, /.../n, is historical. It doesn't mean the regexp works as binary match since Ruby 1.9. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a698d99703
commit
d8cee4ff0a
2 changed files with 7 additions and 7 deletions
2
re.c
2
re.c
|
@ -1410,7 +1410,7 @@ rb_reg_prepare_enc(VALUE re, VALUE str, int warn)
|
|||
else if (warn && (RBASIC(re)->flags & REG_ENCODING_NONE) &&
|
||||
enc != rb_ascii8bit_encoding() &&
|
||||
cr != ENC_CODERANGE_7BIT) {
|
||||
rb_warn("binary regexp match /.../n against %s string",
|
||||
rb_warn("historical binary regexp match /.../n against %s string",
|
||||
rb_enc_name(enc));
|
||||
}
|
||||
return enc;
|
||||
|
|
|
@ -465,7 +465,7 @@ class TestM17N < Test::Unit::TestCase
|
|||
def test_regexp_ascii_none
|
||||
r = /a/n
|
||||
|
||||
assert_warning(%r{binary regexp match /\.\.\./n against}) {
|
||||
assert_warning(%r{historical binary regexp match /\.\.\./n against}) {
|
||||
assert_regexp_generic_ascii(r)
|
||||
}
|
||||
|
||||
|
@ -474,13 +474,13 @@ class TestM17N < Test::Unit::TestCase
|
|||
assert_equal(0, r =~ s("a"))
|
||||
assert_equal(0, r =~ u("a"))
|
||||
assert_equal(nil, r =~ a("\xc2\xa1"))
|
||||
assert_warning(%r{binary regexp match /\.\.\./n against EUC-JP string}) {
|
||||
assert_warning(%r{historical binary regexp match /\.\.\./n against EUC-JP string}) {
|
||||
assert_equal(nil, r =~ e("\xc2\xa1"))
|
||||
}
|
||||
assert_warning(%r{binary regexp match /\.\.\./n against Windows-31J string}) {
|
||||
assert_warning(%r{historical binary regexp match /\.\.\./n against Windows-31J string}) {
|
||||
assert_equal(nil, r =~ s("\xc2\xa1"))
|
||||
}
|
||||
assert_warning(%r{binary regexp match /\.\.\./n against UTF-8 string}) {
|
||||
assert_warning(%r{historical binary regexp match /\.\.\./n against UTF-8 string}) {
|
||||
assert_equal(nil, r =~ u("\xc2\xa1"))
|
||||
}
|
||||
|
||||
|
@ -725,7 +725,7 @@ class TestM17N < Test::Unit::TestCase
|
|||
|
||||
def test_union_1_regexp
|
||||
assert_regexp_generic_ascii(Regexp.union(//))
|
||||
assert_warning(%r{binary regexp match /.../n against}) {
|
||||
assert_warning(%r{historical binary regexp match /.../n against}) {
|
||||
assert_regexp_generic_ascii(Regexp.union(//n))
|
||||
}
|
||||
assert_regexp_fixed_eucjp(Regexp.union(//e))
|
||||
|
@ -768,7 +768,7 @@ class TestM17N < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_dynamic_ascii_regexp
|
||||
assert_warning(%r{binary regexp match /.../n against}) {
|
||||
assert_warning(%r{historical binary regexp match /.../n against}) {
|
||||
assert_regexp_generic_ascii(/#{ }/n)
|
||||
}
|
||||
assert_regexp_fixed_ascii8bit(/#{ }\xc2\xa1/n)
|
||||
|
|
Loading…
Reference in a new issue