summaryrefslogtreecommitdiff
path: root/test/-ext-/integer/test_my_integer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/-ext-/integer/test_my_integer.rb')
-rw-r--r--test/-ext-/integer/test_my_integer.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/-ext-/integer/test_my_integer.rb b/test/-ext-/integer/test_my_integer.rb
new file mode 100644
index 00000000000..bc4757f463c
--- /dev/null
+++ b/test/-ext-/integer/test_my_integer.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: false
+require 'test/unit'
+require "-test-/integer"
+
+class TestIntegerExt < Test::Unit::TestCase
+ def test_my_integer_to_f
+ assert_raise(TypeError) do
+ Bug::Integer::MyInteger.new.to_f
+ end
+
+ begin
+ Bug::Integer::MyInteger.class_eval do
+ def to_f
+ end
+ end
+
+ assert_nothing_raised do
+ Bug::Integer::MyInteger.new.to_f
+ end
+ ensure
+ Bug::Integer::MyInteger.class_eval do
+ remove_method :to_f
+ end
+ end
+ end
+end