зеркало из https://github.com/github/ruby.git
* parse.y (parser_tokadd_escape): no similar messages twice.
[ruby-core:31048] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
98c8e1cd91
Коммит
aac4f022e2
|
@ -1,3 +1,8 @@
|
|||
Sun Aug 8 12:41:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_tokadd_escape): no similar messages twice.
|
||||
[ruby-core:31048]
|
||||
|
||||
Sun Aug 8 10:07:45 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* strftime.c (rb_strftime_with_timespec): suppress warnings.
|
||||
|
|
2
parse.y
2
parse.y
|
@ -5653,7 +5653,7 @@ parser_tokadd_escape(struct parser_params *parser, rb_encoding **encp)
|
|||
case 'x': /* hex constant */
|
||||
{
|
||||
tok_hex(&numlen);
|
||||
if (numlen == 0) goto eof;
|
||||
if (numlen == 0) return -1;
|
||||
tokcopy((int)numlen + 2);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -834,4 +834,11 @@ class TestRegexp < Test::Unit::TestCase
|
|||
def test_property_warn
|
||||
assert_in_out_err('-w', 'x=/\p%s/', [], %r"warning: invalid Unicode Property \\p: /\\p%s/")
|
||||
end
|
||||
|
||||
def test_invalid_escape_error
|
||||
bug3539 = '[ruby-core:31048]'
|
||||
error = assert_raise(SyntaxError) {eval('/\x/', nil, bug3539)}
|
||||
assert_match(/invalid hex escape/, error.message)
|
||||
assert_equal(1, error.message.scan(/.*invalid .*escape.*/i).size, bug3539)
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче