summaryrefslogtreecommitdiff
path: root/test/bigdecimal/test_bigdecimal.rb
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2021-01-12 22:56:54 +0900
committerKenta Murata <mrkn@mrkn.jp>2021-01-13 01:27:04 +0900
commit6670de82c2d7a1449412bf6629aa01cc8ecb35e2 (patch)
treeb786a42439592ec811aef850ae31fae2cef44096 /test/bigdecimal/test_bigdecimal.rb
parent79d236a9f1f8ec6f1c5649852325bdf159a0a162 (diff)
[ruby/bigdecimal] Fix exception message raised in Kernel.BigDecimal
https://github.com/ruby/bigdecimal/commit/d163f170a4 https://github.com/ruby/bigdecimal/commit/ff8eeeb064
Diffstat (limited to 'test/bigdecimal/test_bigdecimal.rb')
-rw-r--r--test/bigdecimal/test_bigdecimal.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index fbe0d7e..b15b046 100644
--- a/test/bigdecimal/test_bigdecimal.rb
+++ b/test/bigdecimal/test_bigdecimal.rb
@@ -228,9 +228,18 @@ class TestBigDecimal < Test::Unit::TestCase
# assert_nothing_raised(RangeError) {
# assert_equal(nil, BigDecimal(1i, exception: false))
# }
- assert_raise(TypeError) {
+ assert_raise_with_message(TypeError, "can't convert nil into BigDecimal") {
BigDecimal(nil, exception: true)
}
+ assert_raise_with_message(TypeError, "can't convert true into BigDecimal") {
+ BigDecimal(true, exception: true)
+ }
+ assert_raise_with_message(TypeError, "can't convert false into BigDecimal") {
+ BigDecimal(false, exception: true)
+ }
+ assert_raise_with_message(TypeError, "can't convert Object into BigDecimal") {
+ BigDecimal(Object.new, exception: true)
+ }
assert_nothing_raised(TypeError) {
assert_equal(nil, BigDecimal(nil, exception: false))
}
@@ -240,6 +249,9 @@ class TestBigDecimal < Test::Unit::TestCase
assert_nothing_raised(TypeError) {
assert_equal(nil, BigDecimal(Object.new, exception: false))
}
+ assert_nothing_raised(TypeError) {
+ assert_equal(nil, BigDecimal(Object.new, exception: false))
+ }
# TODO: support to_d
# assert_nothing_raised(TypeError) {
# o = Object.new