1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2012-08-23 11:51:30 +00:00
parent 6a80947a4b
commit 1e73d66f6b
5 changed files with 30 additions and 0 deletions

View file

@ -1,3 +1,13 @@
Thu Aug 23 20:48:45 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* 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@ruby-lang.org>
* class.c (singleton_class_of): flonum can't have singleton class.

View file

@ -505,4 +505,9 @@ class TestBignum < Test::Unit::TestCase
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

View file

@ -271,4 +271,8 @@ class TestFixnum < Test::Unit::TestCase
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

View file

@ -600,4 +600,11 @@ class TestFloat < Test::Unit::TestCase
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

View file

@ -168,4 +168,8 @@ class TestSymbol < Test::Unit::TestCase
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