summaryrefslogtreecommitdiff
path: root/vendor/bundle/ruby/3.4.0/gems/eventmachine-1.2.7/tests/test_exc.rb
diff options
context:
space:
mode:
authorBenjamin Sanders <ben@Benjamins-MacBook-Pro.local>2025-10-11 10:34:24 -0400
committerBenjamin Sanders <ben@Benjamins-MacBook-Pro.local>2025-10-11 10:34:24 -0400
commit5571dc766e2143e39762ff0b47c41d1c2e154f4c (patch)
treef4f124d314a7e76c04484515aa0fd1f2e271a601 /vendor/bundle/ruby/3.4.0/gems/eventmachine-1.2.7/tests/test_exc.rb
parent359f3309c97fc894b63e0a295c76ab298504d635 (diff)
Vendor bundled gems for deployment
Diffstat (limited to 'vendor/bundle/ruby/3.4.0/gems/eventmachine-1.2.7/tests/test_exc.rb')
-rw-r--r--vendor/bundle/ruby/3.4.0/gems/eventmachine-1.2.7/tests/test_exc.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/bundle/ruby/3.4.0/gems/eventmachine-1.2.7/tests/test_exc.rb b/vendor/bundle/ruby/3.4.0/gems/eventmachine-1.2.7/tests/test_exc.rb
new file mode 100644
index 0000000..d9c860a
--- /dev/null
+++ b/vendor/bundle/ruby/3.4.0/gems/eventmachine-1.2.7/tests/test_exc.rb
@@ -0,0 +1,43 @@
+require 'em_test_helper'
+
+class TestSomeExceptions < Test::Unit::TestCase
+ class DoomedConnectionError < StandardError
+ end
+ class DoomedConnection < EventMachine::Connection
+ def unbind
+ raise DoomedConnectionError
+ end
+ end
+
+ # Read the commentary in EM#run.
+ # This test exercises the ensure block in #run that makes sure
+ # EM#release_machine gets called even if an exception is
+ # thrown within the user code. Without the ensured call to release_machine,
+ # the second call to EM#run will fail with a C++ exception
+ # because the machine wasn't cleaned up properly.
+
+ def test_a
+ assert_raises(RuntimeError) {
+ EM.run {
+ raise "some exception"
+ }
+ }
+ end
+
+ def test_b
+ assert_raises(RuntimeError) {
+ EM.run {
+ raise "some exception"
+ }
+ }
+ end
+
+ def test_exception_on_unbind
+ assert_raises(DoomedConnectionError) {
+ EM.run {
+ EM.connect("localhost", 8888, DoomedConnection)
+ }
+ }
+ end
+
+end