summaryrefslogtreecommitdiff
path: root/jni/ruby/test/-ext-/exception
diff options
context:
space:
mode:
Diffstat (limited to 'jni/ruby/test/-ext-/exception')
-rw-r--r--jni/ruby/test/-ext-/exception/test_data_error.rb13
-rw-r--r--jni/ruby/test/-ext-/exception/test_enc_raise.rb15
-rw-r--r--jni/ruby/test/-ext-/exception/test_ensured.rb31
3 files changed, 59 insertions, 0 deletions
diff --git a/jni/ruby/test/-ext-/exception/test_data_error.rb b/jni/ruby/test/-ext-/exception/test_data_error.rb
new file mode 100644
index 0000000..53cbb28
--- /dev/null
+++ b/jni/ruby/test/-ext-/exception/test_data_error.rb
@@ -0,0 +1,13 @@
+require 'test/unit'
+
+module Bug
+ class TestException < Test::Unit::TestCase
+ def test_cleanup_data_error
+ bug9167 = '[ruby-core:58643] [Bug #9167]'
+ assert_normal_exit(<<-'end;', bug9167) # do
+ require '-test-/exception'
+ raise Bug::Exception::DataError, "Error"
+ end;
+ end
+ end
+end
diff --git a/jni/ruby/test/-ext-/exception/test_enc_raise.rb b/jni/ruby/test/-ext-/exception/test_enc_raise.rb
new file mode 100644
index 0000000..a578b16
--- /dev/null
+++ b/jni/ruby/test/-ext-/exception/test_enc_raise.rb
@@ -0,0 +1,15 @@
+require 'test/unit'
+require '-test-/exception'
+
+module Bug
+ class TestException < Test::Unit::TestCase
+ def test_enc_raise
+ feature5650 = '[ruby-core:41160]'
+ Encoding.list.each do |enc|
+ next unless enc.ascii_compatible?
+ e = assert_raise(Bug::Exception) {Bug::Exception.enc_raise(enc, "[Feature #5650]")}
+ assert_equal(enc, e.message.encoding, feature5650)
+ end
+ end
+ end
+end
diff --git a/jni/ruby/test/-ext-/exception/test_ensured.rb b/jni/ruby/test/-ext-/exception/test_ensured.rb
new file mode 100644
index 0000000..97d9794
--- /dev/null
+++ b/jni/ruby/test/-ext-/exception/test_ensured.rb
@@ -0,0 +1,31 @@
+require 'test/unit'
+
+module Bug
+ class Bug7802 < RuntimeError
+ end
+
+ class TestException < Test::Unit::TestCase
+ def test_ensured
+ assert_separately([], <<-'end;') # do
+
+ require '-test-/exception'
+
+ module Bug
+ class Bug7802 < RuntimeError
+ def try_method
+ raise self
+ end
+
+ def ensured_method
+ [1].detect {|i| true}
+ end
+ end
+ end
+
+ assert_raise(Bug::Bug7802, '[ruby-core:52022] [Bug #7802]') {
+ Bug::Exception.ensured(Bug::Bug7802.new)
+ }
+ end;
+ end
+ end
+end