1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/ruby/test_ast.rb: assert error messages too

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-09-07 03:42:51 +00:00
parent 32aeb3dd4e
commit 68df2b0881

View file

@ -155,14 +155,18 @@ class TestAst < Test::Unit::TestCase
end
def test_parse_raises_syntax_error
assert_raise(SyntaxError) { RubyVM::AST.parse("end") }
assert_raise_with_message(SyntaxError, /keyword_end/) do
RubyVM::AST.parse("end")
end
end
def test_parse_file_raises_syntax_error
Tempfile.create(%w"test_ast .rb") do |f|
f.puts "end"
f.close
assert_raise(SyntaxError) { RubyVM::AST.parse_file(f.path) }
assert_raise_with_message(SyntaxError, /keyword_end/) do
RubyVM::AST.parse_file(f.path)
end
end
end