summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-18 01:29:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-18 01:29:54 +0000
commit849c4eaaf3a03e98ee1f7aefbf58ec152585e4df (patch)
tree5f85c3a2cf015208b876eb38b5e16044dd1db3b2
parent46a45ca613321a8fa3fdee1d358a609b1635625e (diff)
test_syntax.rb: test_unassignable
* test/ruby/test_syntax.rb (TestSyntax#test_unassignable): assert keywords are unassignable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_syntax.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 35c70254bf..8b89f95dc4 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -186,6 +186,12 @@ class TestSyntax < Test::Unit::TestCase
assert_valid_syntax("def self; :foo; end", __FILE__, bug6403)
end
+ def test_unassignable
+ %w[self nil true false __FILE__ __LINE__ __ENCODING__].each do |kwd|
+ assert_raise(SyntaxError) {eval("#{kwd} = nil")}
+ end
+ end
+
private
def not_label(x) @result = x; @not_label ||= nil end