diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-01 13:04:04 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-01 13:04:04 +0000 |
commit | a3e5a86596c8a34559361055911f724a2200d287 (patch) | |
tree | 9147a4da9226f945c134cb304806de4396c94c3c /test/bigdecimal/test_bigdecimal.rb | |
parent | 2e6b5ece958d6bfb389d2b0cb9fedce0e733214f (diff) | |
download | ruby-a3e5a86596c8a34559361055911f724a2200d287.tar.gz |
* ext/bigdecimal/bigdecimal.c (BigDecimal_new),
test/bigdecimal/test_bigdecimal.rb:
Fix exception message of BigDecimal constructor with a Float.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/bigdecimal/test_bigdecimal.rb')
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index e1f98a28ca..ed4a1d40ab 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -52,6 +52,18 @@ class TestBigDecimal < Test::Unit::TestCase assert_equal(1, BigDecimal("1")) assert_equal(1, BigDecimal("1", 1)) assert_raise(ArgumentError) { BigDecimal("1", -1) } + assert_raise(ArgumentError) { BigDecimal(4.2) } + begin + BigDecimal(4.2) + rescue ArgumentError => error + assert_match(/Float/, error.message) + end + assert_raise(ArgumentError) { BigDecimal(42.quo(7)) } + begin + BigDecimal(42.quo(7)) + rescue ArgumentError => error + assert_match(/Rational/, error.message) + end end def test_global_new_with_integer |