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

ruby-changes:14022

From: shugo <ko1@a...>
Date: Wed, 18 Nov 2009 10:15:06 +0900 (JST)
Subject: [ruby-changes:14022] Ruby:r25832 (trunk): forgot to add test_undef.rb in the previous revision.

shugo	2009-11-18 10:14:54 +0900 (Wed, 18 Nov 2009)

  New Revision: 25832

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

  Log:
    forgot to add test_undef.rb in the previous revision.

  Added files:
    trunk/test/ruby/test_undef.rb

Index: test/ruby/test_undef.rb
===================================================================
--- test/ruby/test_undef.rb	(revision 0)
+++ test/ruby/test_undef.rb	(revision 25832)
@@ -0,0 +1,37 @@
+require 'test/unit'
+
+class TestUndef < Test::Unit::TestCase
+  class Undef0
+    def foo
+      "foo"
+    end
+    undef foo
+  end
+
+  class Undef1
+    def bar
+      "bar"
+    end
+  end
+
+  class Undef2 < Undef1
+    undef bar
+  end
+
+  def test_undef
+    x = Undef0.new
+    assert_raise(NoMethodError) { x.foo }
+    y = Undef1.new
+    assert_equal "bar", y.bar
+    z = Undef2.new
+    assert_raise(NoMethodError) { z.foo }
+  end
+
+  def test_special_const_undef
+    assert_raise(TypeError) do
+      1.instance_eval do
+        undef to_s
+      end
+    end
+  end
+end

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

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