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