Permalink
Browse files

Use custom error in test.

  • Loading branch information...
1 parent 010fc0f commit 408450569e742016bafaeac2a3c2164532fa8937 @jimweirich committed Mar 17, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 test/test_rake_thread_pool.rb
@@ -70,20 +70,21 @@ def test_pool_join_empties_queue
assert_equal true, pool.__send__(:__queue__).empty?, "queue should be empty"
end
+ CustomError = Class.new(StandardError)
+
# test that throwing an exception way down in the blocks propagates
# to the top
def test_exceptions
pool = ThreadPool.new(10)
deep_exception_block = lambda do |count|
- raise Exception.new if ( count < 1 )
+ raise CustomError if ( count < 1 )
pool.future(count-1, &deep_exception_block).value
end
- assert_raises(Exception) do
+ assert_raises(CustomError) do
pool.future(2, &deep_exception_block).value
end
-
end
def test_pool_prevents_deadlock

0 comments on commit 4084505

Please sign in to comment.