From 7fc0105f653157e11a4e8747dea65d0197097359 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 11 May 2013 19:33:51 +0000 Subject: merge revision(s) 40606,40607,40635: [Backport #8375] test_scanner_events.rb: assert_location * test/ripper/test_scanner_events.rb (TestRipper#assert_location): rename so skipped in backtraces. * parse.y (parser_yylex): fail if $, @, @@ are not followed by a valid name character. [ruby-core:54846] [Bug #8375]. * parse.y (parser_peek_variable_name): treat invalid global, class, and instance variable names as mere strings rather than errors. [ruby-core:54885] [Bug #8375] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_parse.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'test/ruby/test_parse.rb') diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index d6e42b12eb..05fedb7ca6 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -361,6 +361,17 @@ class TestParse < Test::Unit::TestCase assert_equal("foo 1 bar", "foo #$1 bar") end + def test_dstr_disallowd_variable + bug8375 = '[ruby-core:54885] [Bug #8375]' + %w[@ @1 @@. @@ @@1 @@. $ $%].each do |src| + src = '#'+src+' ' + str = assert_nothing_raised(SyntaxError, "#{bug8375} #{src.dump}") do + break eval('"'+src+'"') + end + assert_equal(src, str, bug8375) + end + end + def test_dsym assert_nothing_raised { eval(':""') } end @@ -527,13 +538,14 @@ class TestParse < Test::Unit::TestCase ) end - assert_raise(SyntaxError) do - eval %q( + assert_nothing_raised(SyntaxError) do + x = eval %q( <