diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-25 08:31:40 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-25 08:31:40 +0000 |
commit | 87b03e8c3c85ecca2c22c03fa539e8ed2c95451d (patch) | |
tree | a11d7745b8d007551e092a0e970b3321fab2a71f /test/ruby | |
parent | 2b9448fd77a55139209ba698e1740c57ec7fad76 (diff) | |
download | ruby-87b03e8c3c85ecca2c22c03fa539e8ed2c95451d.tar.gz |
parser: improve error messages
[Fix GH-2011]
From: Akim Demaille <akim.demaille@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_ast.rb | 4 | ||||
-rw-r--r-- | test/ruby/test_iseq.rb | 2 | ||||
-rw-r--r-- | test/ruby/test_syntax.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index 05f4211cba..31744e9215 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -155,7 +155,7 @@ class TestAst < Test::Unit::TestCase end def test_parse_raises_syntax_error - assert_raise_with_message(SyntaxError, /keyword_end/) do + assert_raise_with_message(SyntaxError, /\bend\b/) do RubyVM::AbstractSyntaxTree.parse("end") end end @@ -164,7 +164,7 @@ class TestAst < Test::Unit::TestCase Tempfile.create(%w"test_ast .rb") do |f| f.puts "end" f.close - assert_raise_with_message(SyntaxError, /keyword_end/) do + assert_raise_with_message(SyntaxError, /\bend\b/) do RubyVM::AbstractSyntaxTree.parse_file(f.path) end end diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index 078c11472d..ccff553e6f 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -256,7 +256,7 @@ class TestISeq < Test::Unit::TestCase f.puts "end" f.close path = f.path - assert_in_out_err(%W[- #{path}], "#{<<-"begin;"}\n#{<<-"end;"}", /keyword_end/, [], success: true) + assert_in_out_err(%W[- #{path}], "#{<<-"begin;"}\n#{<<-"end;"}", /unexpected end/, [], success: true) begin; path = ARGV[0] begin diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index bd9c996138..dee9187a9c 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -989,7 +989,7 @@ eom end def test_parenthesised_statement_argument - assert_syntax_error("foo(bar rescue nil)", /unexpected modifier_rescue/) + assert_syntax_error("foo(bar rescue nil)", /unexpected rescue \(modifier\)/) assert_valid_syntax("foo (bar rescue nil)") end |