mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	test/test_timeout.rb (TestTimeout#test_timeout): add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									46f23b51f6
								
							
						
					
					
						commit
						f4f3096dd3
					
				
					 2 changed files with 18 additions and 1 deletions
				
			
		|  | @ -1,3 +1,7 @@ | |||
| Tue Apr 28 19:09:45 2009  Kazuhiro NISHIYAMA  <zn@mbf.nifty.com> | ||||
| 
 | ||||
| 	* test/test_timeout.rb (TestTimeout#test_timeout): add a test. | ||||
| 
 | ||||
| Tue Apr 28 07:13:48 2009  Nobuyoshi Nakada  <nobu@ruby-lang.org> | ||||
| 
 | ||||
| 	* lib/pp.rb (Struct#pretty_print): coerce to a string since | ||||
|  |  | |||
|  | @ -9,5 +9,18 @@ class TestTimeout < Test::Unit::TestCase | |||
|       timeout(0.1) { q.pop } | ||||
|     } | ||||
|   end | ||||
| end | ||||
| 
 | ||||
|   def test_timeout | ||||
|     @flag = true | ||||
|     Thread.start { | ||||
|       sleep 0.1 | ||||
|       @flag = false | ||||
|     } | ||||
|     assert_nothing_raised("[ruby-dev:38319]") do | ||||
|       Timeout.timeout(1) { | ||||
|         nil while @flag | ||||
|       } | ||||
|     end | ||||
|     assert !@flag, "[ruby-dev:38319]" | ||||
|   end | ||||
| end | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 kazu
						kazu