summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-07 12:04:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-07 12:04:43 +0000
commitc31f6285c71ec0ad8052205d7029986453c465ce (patch)
treee4089377558073d53e94c8fb2fc00c12f21ee909 /test
parentb31ba1056ee4647f188b997dcb47450bfe1cb25e (diff)
complex.c: check type
* complex.c (m_cos, m_sin): determine the type by the internal type, not by a method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_complex.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index 48fb9947a3..c2ed1b0827 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -970,4 +970,18 @@ class Complex_Test < Test::Unit::TestCase
assert_equal(obj, c.real)
assert_equal(-1, c.imag)
end
+
+ def test_canonicalize_polar
+ obj = Class.new(Numeric) do
+ def initialize
+ @x = 2
+ end
+ def real?
+ (@x -= 1) > 0
+ end
+ end.new
+ assert_raise(TypeError) do
+ Complex.polar(1, obj)
+ end
+ end
end