[前][次][番号順一覧][スレッド一覧]

ruby-changes:25198

From: nobu <ko1@a...>
Date: Thu, 18 Oct 2012 10:32:58 +0900 (JST)
Subject: [ruby-changes:25198] nobu:r37250 (trunk): test_syntax.rb: test_unassignable

nobu	2012-10-18 10:29:54 +0900 (Thu, 18 Oct 2012)

  New Revision: 37250

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37250

  Log:
    test_syntax.rb: test_unassignable
    
    * test/ruby/test_syntax.rb (TestSyntax#test_unassignable): assert
      keywords are unassignable.

  Modified files:
    trunk/test/ruby/test_syntax.rb

Index: test/ruby/test_syntax.rb
===================================================================
--- test/ruby/test_syntax.rb	(revision 37249)
+++ test/ruby/test_syntax.rb	(revision 37250)
@@ -186,6 +186,12 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]