aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-05 08:32:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-05 08:32:46 +0000
commit43a6d8c9a1aa65705f169e2e6daf1e4b7940d7ee (patch)
treeeb4915eacb8e1ebe6797c03d2af8e8b292fa8268 /test
parent5182db885b9824176e256efaa2c5700f286ed5c6 (diff)
downloadruby-43a6d8c9a1aa65705f169e2e6daf1e4b7940d7ee.tar.gz
parse.y: named whitespaces
* parse.y: named escaped whitespaces to show unexpected character. bare whitespaces should not appear outside of word_list. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_parse.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index e843c66242..cd1c5a3ecc 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -1129,6 +1129,27 @@ x = __ENCODING__
end
end
+ def test_whitespace_warning
+ assert_raise_with_message(SyntaxError, /backslash/) do
+ eval("\\foo")
+ end
+ assert_raise_with_message(SyntaxError, /escaped space/) do
+ eval("\\ ")
+ end
+ assert_raise_with_message(SyntaxError, /escaped horizontal tab/) do
+ eval("\\\t")
+ end
+ assert_raise_with_message(SyntaxError, /escaped form feed/) do
+ eval("\\\f")
+ end
+ assert_raise_with_message(SyntaxError, /escaped carriage return/) do
+ assert_warn(/middle of line/) {eval("\\\r")}
+ end
+ assert_raise_with_message(SyntaxError, /escaped vertical tab/) do
+ eval("\\\v")
+ end
+ end
+
=begin
def test_past_scope_variable
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}