diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 17:39:48 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 17:39:48 +0000 |
commit | 279cd29b1b544cba09f5839d4abce81ab322d2c6 (patch) | |
tree | 2a0e983940bff674c5e52c7aa769d3dcde64eeba /test/ruby | |
parent | 6ca32179e6d04cc6b22c4c2bbb55d3cc34127b3b (diff) | |
download | ruby-279cd29b1b544cba09f5839d4abce81ab322d2c6.tar.gz |
* thread.c (rb_threadptr_interrupt_mask): add argument check.
* thread.c (async_interrupt_timing_arg_check_i): helper function
for the above.
* test/ruby/test_thread.rb (test_async_interrupt_timing_invalid_argument):
test for the above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_thread.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 53111d9458..beee4c4be5 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -714,6 +714,18 @@ class TestThread < Test::Unit::TestCase # TODO: complex cases are needed. end + def test_async_interrupt_timing_invalid_argument + assert_raise(ArgumentError) { + Thread.async_interrupt_timing(RuntimeError => :immediate) # no block + } + assert_raise(ArgumentError) { + Thread.async_interrupt_timing(RuntimeError => :never) {} # never? + } + assert_raise(TypeError) { + Thread.async_interrupt_timing([]) {} # array + } + end + def test_async_interrupted? q = Queue.new Thread.async_interrupt_timing(RuntimeError => :defer){ |