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

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
This commit is contained in:
nobu 2012-10-18 01:29:54 +00:00
parent 46a45ca613
commit 849c4eaaf3

View file

@ -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