summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-20 13:22:56 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-20 13:22:56 +0000
commit26879c174286627c08a9c7440674922dd25ec16a (patch)
tree6b2072d46f008b724a9b6c090d475f93ccc7154e
parentd3418343048213457d0686b807404babc949e994 (diff)
merges most of r29882 from trunk into ruby_1_9_2.
-- added some tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_complex.rb17
-rw-r--r--test/ruby/test_rational.rb20
-rw-r--r--version.h2
3 files changed, 38 insertions, 1 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index b2894610f7..d49204d222 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -517,6 +517,23 @@ class Complex_Test < Test::Unit::TestCase
assert_equal([Complex(2),Complex(1)], Complex(1).coerce(Complex(2)))
end
+ class ObjectX
+ def + (x) Rational(1) end
+ alias - +
+ alias * +
+ alias / +
+ alias quo +
+ alias ** +
+ def coerce(x) [x, Complex(1)] end
+ end
+
+ def test_coerce2
+ x = ObjectX.new
+ %w(+ - * / quo **).each do |op|
+ assert_kind_of(Numeric, Complex(1).__send__(op, x))
+ end
+ end
+
def test_unify
if @unify
assert_instance_of(Fixnum, Complex(1,2) + Complex(-1,-2))
diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb
index 2f33ec2039..438bfff638 100644
--- a/test/ruby/test_rational.rb
+++ b/test/ruby/test_rational.rb
@@ -718,6 +718,26 @@ class Rational_Test < Test::Unit::TestCase
assert_equal([Rational(2),Rational(1)], Rational(1).coerce(Rational(2)))
end
+ class ObjectX
+ def + (x) Rational(1) end
+ alias - +
+ alias * +
+ alias / +
+ alias quo +
+ alias div +
+ alias % +
+ alias remainder +
+ alias ** +
+ def coerce(x) [x, Rational(1)] end
+ end
+
+ def test_coerce2
+ x = ObjectX.new
+ %w(+ - * / quo div % remainder **).each do |op|
+ assert_kind_of(Numeric, Rational(1).__send__(op, x))
+ end
+ end
+
def test_unify
if @unify
assert_instance_of(Fixnum, Rational(1,2) + Rational(1,2))
diff --git a/version.h b/version.h
index 603b06f4ce..a30cacf2e8 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 103
+#define RUBY_PATCHLEVEL 104
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1