Escape control codes in regexp warning message
This commit is contained in:
parent
27723b699b
commit
792d1deb94
@ -356,7 +356,8 @@ onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
|
|||||||
*s++ = *p++;
|
*s++ = *p++;
|
||||||
}
|
}
|
||||||
else if (!ONIGENC_IS_CODE_PRINT(enc, *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++));
|
sprint_byte_with_x((char* )bs, (unsigned int )(*p++));
|
||||||
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
||||||
bp = bs;
|
bp = bs;
|
||||||
|
@ -1124,6 +1124,8 @@ class TestRegexp < Test::Unit::TestCase
|
|||||||
|
|
||||||
bug8151 = '[ruby-core:53649]'
|
bug8151 = '[ruby-core:53649]'
|
||||||
assert_warning(/\A\z/, bug8151) { Regexp.new('(?:[\u{33}])').to_s }
|
assert_warning(/\A\z/, bug8151) { Regexp.new('(?:[\u{33}])').to_s }
|
||||||
|
|
||||||
|
assert_warning(%r[/.*/\Z]) { Regexp.new("[\n\n]") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_property_warn
|
def test_property_warn
|
||||||
|
Loading…
x
Reference in New Issue
Block a user