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

ruby-changes:24753

From: usa <ko1@a...>
Date: Thu, 23 Aug 2012 20:52:04 +0900 (JST)
Subject: [ruby-changes:24753] usa:r36804 (trunk): * test/ruby/test_fixnum.rb (TestFixnum#test_singleton_method): new test.

usa	2012-08-23 20:51:30 +0900 (Thu, 23 Aug 2012)

  New Revision: 36804

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

  Log:
    * test/ruby/test_fixnum.rb (TestFixnum#test_singleton_method): new test.
    
    * test/ruby/test_bignum.rb (TestBignum#test_singleton_method): ditto.
    
    * test/ruby/test_float.rb (TestFloat#test_singleton_method): ditto.
    
    * test/ruby/test_symbol.rb (TestSymbol#test_singleton_method): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_bignum.rb
    trunk/test/ruby/test_fixnum.rb
    trunk/test/ruby/test_float.rb
    trunk/test/ruby/test_symbol.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 36803)
+++ ChangeLog	(revision 36804)
@@ -1,3 +1,13 @@
+Thu Aug 23 20:48:45 2012  NAKAMURA Usaku  <usa@r...>
+
+	* test/ruby/test_fixnum.rb (TestFixnum#test_singleton_method): new test.
+
+	* test/ruby/test_bignum.rb (TestBignum#test_singleton_method): ditto.
+
+	* test/ruby/test_float.rb (TestFloat#test_singleton_method): ditto.
+
+	* test/ruby/test_symbol.rb (TestSymbol#test_singleton_method): ditto.
+
 Thu Aug 23 20:34:32 2012  NAKAMURA Usaku  <usa@r...>
 
 	* class.c (singleton_class_of): flonum can't have singleton class.
Index: test/ruby/test_bignum.rb
===================================================================
--- test/ruby/test_bignum.rb	(revision 36803)
+++ test/ruby/test_bignum.rb	(revision 36804)
@@ -505,4 +505,9 @@
     def o.coerce(x); [x, 2**100]; end
     assert_equal((2**200).to_f, (2**300).fdiv(o))
   end
+
+  def test_singleton_method
+    # this test assumes 32bit/64bit platform
+    assert_raise(TypeError) { a = 1 << 64; def a.foo; end }
+  end
 end
Index: test/ruby/test_float.rb
===================================================================
--- test/ruby/test_float.rb	(revision 36803)
+++ test/ruby/test_float.rb	(revision 36804)
@@ -600,4 +600,11 @@
       assert_operator(n, :<=, e)
     end
   end
+
+  def test_singleton_method
+    # flonum on 64bit platform
+    assert_raise(TypeError) { a = 1.0; def a.foo; end }
+    # always not flonum
+    assert_raise(TypeError) { a = Float::INFINITY; def a.foo; end }
+  end
 end
Index: test/ruby/test_symbol.rb
===================================================================
--- test/ruby/test_symbol.rb	(revision 36803)
+++ test/ruby/test_symbol.rb	(revision 36804)
@@ -168,4 +168,8 @@
     assert_equal(Encoding::UTF_8, "\u{2192}".intern.encoding)
     assert_raise(EncodingError) {"\xb0a".force_encoding("utf-8").intern}
   end
+
+  def test_singleton_method
+    assert_raise(TypeError) { a = :foo; def a.foo; end }
+  end
 end
Index: test/ruby/test_fixnum.rb
===================================================================
--- test/ruby/test_fixnum.rb	(revision 36803)
+++ test/ruby/test_fixnum.rb	(revision 36804)
@@ -271,4 +271,8 @@
   def test_xor_with_nonintegral_numeric
     assert_raise(TypeError, "#1792") { 1 ^ DummyNumeric.new }
   end
+
+  def test_singleton_method
+    assert_raise(TypeError) { a = 1; def a.foo; end }
+  end
 end

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

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