diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-07 11:54:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-07 11:54:07 +0000 |
commit | b31ba1056ee4647f188b997dcb47450bfe1cb25e (patch) | |
tree | 88550df5f6b1e740ed63b379c710e2b40675b5a5 /test | |
parent | b479a2d43953ef8e1b498a3f1c0dac3e32269c69 (diff) |
complex.c: check type
* complex.c (nucomp_s_canonicalize_internal): determine the type
by the internal type, not by a method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_complex.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb index 316e3e21ff..48fb9947a3 100644 --- a/test/ruby/test_complex.rb +++ b/test/ruby/test_complex.rb @@ -958,4 +958,16 @@ class Complex_Test < Test::Unit::TestCase def test_known_bug end + def test_canonicalize_internal + obj = Class.new(Numeric) do + attr_accessor :real + alias real? real + end.new + obj.real = true + c = Complex.rect(obj, 1); + obj.real = false + c = c.conj + assert_equal(obj, c.real) + assert_equal(-1, c.imag) + end end |