parse.y: add ellipsis

* parse.y (parser_yyerror): add ellipsis properly when error line
  is truncated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-06-28 05:38:27 +00:00
parent 3462dd3609
commit 7c7d74365d
2 changed files with 26 additions and 21 deletions

View file

@ -1013,6 +1013,15 @@ x = __ENCODING__
end
end
def test_truncated_source_line
e = assert_raise_with_message(SyntaxError, /unexpected tIDENTIFIER/) do
eval("'0123456789012345678901234567890123456789' abcdefghijklmnopqrstuvwxyz0123456789 0123456789012345678901234567890123456789")
end
line = e.message.lines[1]
assert_operator(line, :start_with?, "...")
assert_operator(line, :end_with?, "...\n")
end
=begin
def test_past_scope_variable
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}