diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-08 03:41:30 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-08 03:41:30 +0000 |
commit | aac4f022e2b4bb601f5068bfc7e25de49493563f (patch) | |
tree | 67412a235ea79a68a8b8daea03a127c274f48208 | |
parent | 98c8e1cd91819042b13eb5aa69d86cb813a9bcaa (diff) |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | test/ruby/test_regexp.rb | 7 |
3 files changed, 13 insertions, 1 deletions
@@ -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. @@ -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; diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 35162310db..874b1873e7 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -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 |