summaryrefslogtreecommitdiff
path: root/test/bigdecimal/test_bigdecimal.rb
diff options
context:
space:
mode:
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 fbe0d7e98a..b15b046f4c 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