aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_prec.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-07 15:09:12 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-07 15:09:12 +0000
commit2bef7dece17c3ef98c1c0aca08d4028d6afc998a (patch)
tree051efbdc49a2d8db94b4a12e11ccd10f37fb78ee /test/ruby/test_prec.rb
parent1809782c3eaa24fc751ac2fd96fb204a51c15e68 (diff)
downloadruby-2bef7dece17c3ef98c1c0aca08d4028d6afc998a.tar.gz
* test/ruby/test_hash.rb: follow the change of Hash#flatten.
* test/ruby/test_time.rb: add tests to achieve over 70% test coverage of time.c. * test/ruby/test_prec.rb: ditto over 90% for prec.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_prec.rb')
-rw-r--r--test/ruby/test_prec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_prec.rb b/test/ruby/test_prec.rb
new file mode 100644
index 0000000000..d872242c11
--- /dev/null
+++ b/test/ruby/test_prec.rb
@@ -0,0 +1,21 @@
+require 'test/unit'
+
+class TestPrecision < Test::Unit::TestCase
+ def test_prec_i
+ assert_same(1, 1.0.prec(Integer))
+ assert_same(1, 1.0.prec_i)
+ assert_same(1, Integer.induced_from(1.0))
+ end
+
+ def test_prec_f
+ assert_equal(1.0, 1.prec(Float))
+ assert_equal(1.0, 1.prec_f)
+ assert_equal(1.0, Float.induced_from(1))
+ end
+
+ def test_induced_from
+ m = Module.new
+ m.instance_eval { include(Precision) }
+ assert_raise(TypeError) { m.induced_from(0) }
+ end
+end