mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Escape control codes in regexp warning message
This commit is contained in:
parent
27723b699b
commit
792d1deb94
2 changed files with 4 additions and 1 deletions
|
@ -356,7 +356,8 @@ onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
|
|||
*s++ = *p++;
|
||||
}
|
||||
else if (!ONIGENC_IS_CODE_PRINT(enc, *p) &&
|
||||
!ONIGENC_IS_CODE_SPACE(enc, *p)) {
|
||||
(!ONIGENC_IS_CODE_SPACE(enc, *p) ||
|
||||
ONIGENC_IS_CODE_CNTRL(enc, *p))) {
|
||||
sprint_byte_with_x((char* )bs, (unsigned int )(*p++));
|
||||
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
||||
bp = bs;
|
||||
|
|
|
@ -1124,6 +1124,8 @@ class TestRegexp < Test::Unit::TestCase
|
|||
|
||||
bug8151 = '[ruby-core:53649]'
|
||||
assert_warning(/\A\z/, bug8151) { Regexp.new('(?:[\u{33}])').to_s }
|
||||
|
||||
assert_warning(%r[/.*/\Z]) { Regexp.new("[\n\n]") }
|
||||
end
|
||||
|
||||
def test_property_warn
|
||||
|
|
Loading…
Reference in a new issue