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:
parent
46a45ca613
commit
849c4eaaf3
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user