summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-02 03:00:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-02 03:00:13 +0000
commit6e2ceaf0ed4812dfd8b1df4789c1dfd610e2de86 (patch)
tree6843be90ba51f4341775badd35bf9024dde6fef2 /test
parent691b05e83c41d089c4f6c7a8bbac9dd63f36a144 (diff)
parse.y: code end position
* parse.y (parser_yyerror): use the given location as the end of erred code, instead of the current position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_parse.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 15c6245bac..41aad0050d 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -1099,6 +1099,12 @@ x = __ENCODING__
assert_raise(SyntaxError) { eval("def m\n\C-z""end") }
end
+ def test_location_of_invalid_token
+ assert_raise_with_message(SyntaxError, /^ \^~~\z/) do
+ eval('class xxx end')
+ end
+ end
+
=begin
def test_past_scope_variable
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}