ruby-changes:45611
From: akr <ko1@a...>
Date: Wed, 22 Feb 2017 16:31:30 +0900 (JST)
Subject: [ruby-changes:45611] akr:r57684 (trunk): refine warning message for binary regexp /.../n.
akr 2017-02-22 16:31:25 +0900 (Wed, 22 Feb 2017) New Revision: 57684 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57684 Log: refine warning message for binary regexp /.../n. Reported by Herwin W. [ruby-core:78592] [Bug #13024] Modified files: trunk/re.c trunk/test/ruby/test_m17n.rb Index: test/ruby/test_m17n.rb =================================================================== --- test/ruby/test_m17n.rb (revision 57683) +++ test/ruby/test_m17n.rb (revision 57684) @@ -465,7 +465,7 @@ class TestM17N < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_m17n.rb#L465 def test_regexp_ascii_none r = /a/n - assert_warning(%r{regexp match /\.\.\./n against to}) { + assert_warning(%r{binary regexp match /\.\.\./n against}) { assert_regexp_generic_ascii(r) } @@ -474,13 +474,13 @@ class TestM17N < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_m17n.rb#L474 assert_equal(0, r =~ s("a")) assert_equal(0, r =~ u("a")) assert_equal(nil, r =~ a("\xc2\xa1")) - assert_warning(%r{regexp match /\.\.\./n against to EUC-JP string}) { + assert_warning(%r{binary regexp match /\.\.\./n against EUC-JP string}) { assert_equal(nil, r =~ e("\xc2\xa1")) } - assert_warning(%r{regexp match /\.\.\./n against to Windows-31J string}) { + assert_warning(%r{binary regexp match /\.\.\./n against Windows-31J string}) { assert_equal(nil, r =~ s("\xc2\xa1")) } - assert_warning(%r{regexp match /\.\.\./n against to UTF-8 string}) { + assert_warning(%r{binary regexp match /\.\.\./n against UTF-8 string}) { assert_equal(nil, r =~ u("\xc2\xa1")) } @@ -725,7 +725,7 @@ class TestM17N < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_m17n.rb#L725 def test_union_1_regexp assert_regexp_generic_ascii(Regexp.union(//)) - assert_warning(%r{regexp match /.../n against to}) { + assert_warning(%r{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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_m17n.rb#L768 end def test_dynamic_ascii_regexp - assert_warning(%r{regexp match /.../n against to}) { + assert_warning(%r{binary regexp match /.../n against}) { assert_regexp_generic_ascii(/#{ }/n) } assert_regexp_fixed_ascii8bit(/#{ }\xc2\xa1/n) Index: re.c =================================================================== --- re.c (revision 57683) +++ re.c (revision 57684) @@ -1410,7 +1410,7 @@ rb_reg_prepare_enc(VALUE re, VALUE str, https://github.com/ruby/ruby/blob/trunk/re.c#L1410 else if (warn && (RBASIC(re)->flags & REG_ENCODING_NONE) && enc != rb_ascii8bit_encoding() && cr != ENC_CODERANGE_7BIT) { - rb_warn("regexp match /.../n against to %s string", + rb_warn("binary regexp match /.../n against %s string", rb_enc_name(enc)); } return enc; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/